About Darkon

Build Status codecov License PyPI Gitter Codacy Badge

Darkon: Toolkit to Hack Your Deep Learning Models

Darkon is an open source toolkit to understand deep learning models better. Deep learning is often referred as a black-box that is difficult to understand. But, accountability and controllability could be critical to commercialize deep learning models. People often think that high accuracy on prepared dataset is enough to use the model for commercial products. However, well-performing models on prepared dataset often fail in real world usages and cause corner cases to be fixed. Moreover, it is necessary to explain the result to trust the system in some applications such as medical diagnosis, financial decisions, etc. We hope
Darkon can help you to understand the trained models, which could be used to debug failures, interpret decisions, and so on.

Here, we provide functions to analyze deep learning model decisions easily applicable to any Tensorflow models (other models to be supported later). Influence score can be useful to understand the model through training samples. The score can be used for filtering bad training samples that affects test performance negatively. It is useful to prioritize potential mislabeled examples to be fixed, and debug distribution mismatch between train and test samples. In this version, we have added Grad-CAM and Guided Grad-CAM, which are useful to understand decisions of CNN models.

We will gradually enable technologies to analyze deep learning models easily applicable to your existing projects. More features will be released soon. Feedback and feature request are always welcome, which help us to manage priorities. Please keep your eyes on Darkon.



Install Darkon alone

pip install darkon

Install with TensorFlow CPU

pip install darkon[tensorflow]

Install with TensorFlow GPU

pip install darkon[tensorflow-gpu]



Apache License 2.0


[1] Cook, R. D. and Weisberg, S. “Residuals and influence in regression”, New York: Chapman and Hall, 1982

[2] Koh, P. W. and Liang, P. “Understanding Black-box Predictions via Influence Functions” ICML2017

[3] Pearlmutter, B. A. “Fast exact multiplication by the hessian” Neural Computation, 1994

[4] Agarwal, N., Bullins, B., and Hazan, E. “Second order stochastic optimization in linear time” arXiv preprint arXiv:1602.03943

[5] Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, Dhruv Batra “Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization” ICCV2017