GUI tool to test caffe neural networks.
Provides a simple GUI tool to use CNN. To classify images, you only need to drag and drop.
- Python 2.7
- PyQt4
- pycaffe (python interface of caffe)
- numpy
- matplotlib
- cv2 (python interface of OpenCV)
Prepare files to load CNN
- net.caffemodel - binary proto file for weights of CNN. Obtain by downloading or training.
- deploy.prototxt - define the network structure. Set input layer dim = 1x3x227x227, and set the top layer name as "prob".
- labels.txt - simple text file to list the classes to be classified.
- Create a folder with network name and put these 3 files into that folder.
- Edit
classifier_simpleGUI.py
line 152. Set the argument ofUI()
to the created folder name.
Folder alexnet
is an example.
alexnet/deploy.prototxt
is a modified file of BVLC alexnet (github).
Corresponding caffemodel file can be downloaded from there.
alexnet/labels.txt
is a list of classes. This is extracted from synset_words.txt, which is downloaded from http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz.
- Run
classifier_simpleGUI.py
. Running on terminal is better because some messages will be flushed on stdout/err. - After load the caffe model, an empty window whose title is the same as the network name will launch. Please wait for a while.
- Select image files you want to classify. Drag them to the window and drop.
- After forward calculations, a table which lists top 5 classes for each image will appear. Please wait for a while.
- The actual probability values for each class can be confirmed by pushing "Details" button on the bottom of the window.
- During detail view, you can return to the top 5 list table.
- Dragging and drop other images, the previous results will be discarded an then calculate for new images and prepare a new table.
- To terminate the program, simply close the window.
This program is written to learn how to use PyQt4.
Seiji Ueno