Package: cnn-raccoon
CNN Raccoon v0.9.5Create interactive dashboards for your Convolutional Neural Networks (CNNs) with a single line of code!CNN Raccoonhelps you with inspecting what's going on inside your Convolutional Neural Networks in a visual way that's easy to understand.
Oh! Did I mention that you don't need to change your code at all? And that you can do all of this on a single line of Python code?How to use it?TensorFlow modeWhen using CNN Raccoon for a TensorFlow (Keras) based model, you'll implement your model in the same way as before.
To load images from your dataset into CNN Raccoon, convert them tonp.arrayobject.
Check an example below for theCIFAR10dataset.model=tf.keras.models.Sequential([...])model.compile(...)# You define and compile model in the same way# Let's use Cifar-10 for this example, but can be any datasetfromtensorflow.keras.datasetsimportcifar10(X_train,y_train),(X_test,y_test)=cifar10.load_data()# CNN Raccoon magic!fromcnn_raccoonimportinspector# In a single line of code send your model to the Inspectorinspector(model=model,images=X_train[:10],number_of_classes=10,engine="keras")PyTorch modeIf you decide to use CNN Raccoon for your PyTorch model, you'll implement your model in the same way as before.
To load images from your dataset into CNN Raccoon, convert them to thePyTorch.Variableobject.
The best way to achieve this is by using PyTorch's dataset loader.
Check an example below for theCIFAR10dataset.# For PyTorch you define the model in the same way as beforemodel=Net()# Load dataset using data loaderstransform=transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5,0.5,0.5),(0.5,0.5,0.5))])trainset=torchvision.datasets.CIFAR10(root='./data',train=True,download=True,transform=transform)trainloader=torch.utils.data.DataLoader(trainset,batch_size=4,shuffle=True,num_workers=2)dataiter=iter(trainloader)images,labels=dataiter.next()# CNN Raccoon magic!fromcnn_raccoonimportinspector# In a single line of code send your model to the Inspectorinspector(model=model,images=images,number_of_classes=10,engine="keras")Interactive network graphThis library generates an interactive graph of your CNN directly in a browser. This graph allows you to click and inspect each layer inside your model.Weights inspectorVisualization of each Convolutional filter from your networkGradCamBased on the paperGrad-CAM: Visual Explanations from Deep Networks
via Gradient-based Localization.To learn more about GradCam and Class Activation maps I do suggest reading throughthis post.Siliency MapsBased on the paperDeep Inside Convolutional Networks: Visualising
Image Classification Models and Saliency Maps.To learn more about Saliency Maps I do suggest reading throughthis post.InstallationInstallation withpipYou can install CNN Raccoon directly from the PyPi repository usingpip(orpip3):pipinstallcnn-raccoonManual installationIf you prefer to install it from source:Clone this repositorygitclonehttps://github.com/lucko515/cnn-raccoonGo to the library folder and runpipinstall.RequirementsPyTorch versionInstall all requirements fromrequirements.txtfilepip install -r requirements.txtAfter installing base, requirements make sure you have PyTorch>1.5.0version.
Here is the PyTorch installation guide:https://pytorch.org/get-started/locally/TensorFlow versionInstall all requirements fromrequirements.txtfilepip install -r requirements.txtAfter installing base, requirements make sure you have TensorFlow (w/ Keras API)>2.0.0version.
Here is the TensorFlow (w/ Keras API) installation guide:https://www.tensorflow.org/installTODOIf you want to contribute to the CNN Raccoon, here is what's on the TODO list:Silency Map for theTensorFlowmodeMake dashboard responsive on smaller screens (< 1100px)Interactive CNN BuilderDrag n Drop network builderContactAdd me onLinkedIn