Keras implementation of RetinaNet object detection on logo detection. Forked on https://github.com/fizyr/keras-retinanet. Original paper is Focal Loss for Dense Object Detection.
- Clone this repository.
- In the repository
keras-retinanet
executepython setup.py install --user
. Please make suretensorflow
is installed as per your systems requirements. Also, make sure Keras 2.1.2 is installed. - This repository requires the master branch of
keras-resnet
(runpip install --user --upgrade git+https://github.com/broadinstitute/keras-resnet
).
- Make sure to complete Preparation steps first.
- Download FlickrLogos32 dataset from here.
Extract
FlickrLogos-v2
folder. - Download Logos-32plus_v1.0.1.zip dataset from here.
Extract
images
folder andgroundtruth.mat
file toLogos32plus
folder. - In main repository run command
python prepare.py -f ./../FlickrLogos-v2/ -l ./../Flickr32plus/ -c ./csvpaths/classes.csv -t ./csvpaths/retina-train.csv -v ./csvpaths/retina-valid.csv -s ./csvpaths/retina-test.csv
. Make sure-f
option is FlickrLogos dataset folder path,-l
is Logos32plus dataset path. In csvpaths folder filesretina-valid.csv
,retina-train.csv
andretina-test.csv
should have appeared. - Now run
python train.py -n name_of_snapshot_folder -c ./csvpaths/classes.csv -t ./csvpaths/retina-train.csv -v ./csvpaths/retina-valid.csv
. Folder with weighs and metadata should appear insnapshots
folder.
- Make sure to complete Preparation steps first. Make sure to do 2-4 Training steps.
- Train your own model or download weights from here.
- In this repository run command
python evaluate.py -w weights.h5 -c ./csvpaths/classes.csv -t ./csvpaths/retina-test.csv -o ./evalkit/classification.txt
.-w
is path to weights and-o
is output path. Inevalkit
folderclassification.txt
file should appear. - In
evalkit
folder run commandpython fl_eval_classification.py --flickrlogos=..\..\FlickrLogos-v2 --classification="classification.txt"
. Make sure--flickrlogos
option is path to FlickLogos32 dataset and--classification
option is txt file from step 3. You can useoriginal-classification.txt
which is made on default weights.
- Make sure to complete Preparation steps first.
- Train your own model or download weights from here.
- To evaluate photo run command
python test.py -f ./examples/test.png -o ./examples/output.png -w weights.h5 -c ./csvpaths/classes.csv
. Where-f
is your photo,-o
is output photo,-w
is weights. - To evaluate video run command
python test_video.py -f ./examples/video.mp4 -o ./examples/output_video.mp4 -w weights.h5 -c ./csvpaths/classes.csv
.
- Tensorflow (https://www.tensorflow.org/install/).
- Keras 2.1.2
pip install keras
install after Tensorflow. - OpenCV
pip install opencv-python
.