A brand logo detection system using tensorflow object detection API.
Belows are detection examples.
-
Setup the tensorflow object detection API. First of all, clone the tensorflow/models repository.
$ git clone https://github.com/tensorflow/models.git $ cd models/research/object_detection $ wget http://download.tensorflow.org/models/object_detection/ssd_inception_v2_coco_2018_01_28.tar.gz $ tar zxvf ssd_inception_v2_coco_2018_01_28.tar.gz
For detailed steps to setup, please follow the installation.
-
Clone the DeepLogo repository.
$ git clone https://github.com/satojkovic/DeepLogo.git
-
Download dataset from flickr_27_logos_dataset and extract.
$ cd DeepLogo $ wget http://image.ntua.gr/iva/datasets/flickr_logos/flickr_logos_27_dataset.tar.gz $ tar zxvf flickr_logos_27_dataset.tar.gz $ cd flickr_logos_27_dataset $ tar zxvf flickr_logos_27_dataset_images.tar.gz $ cd ../
-
Preprocess original annotation file and generate flickr_logos_27_dataset_training_set_annotation_cropped.txt and flickr_logos_27_dataset_test_set_annotation_cropped.txt. These two files are used to generate tfrecord files.
$ cd DeepLogo $ python preproc_annot.py
-
Generate tfrecord files.
$ python gen_tfrecord.py --csv_input flickr_logos_27_dataset/flickr_logos_27_dataset_training_set_annotation_cropped.txt --img_dir flickr_logos_27_dataset/flickr_logos_27_dataset_images --output_path train.tfrecord $ python gen_tfrecord.py --csv_input flickr_logos_27_dataset/flickr_logos_27_dataset_test_set_annotation_cropped.txt --img_dir flickr_logos_27_dataset/flickr_logos_27_dataset_images --output_path test.tfrecord
-
Training logo detector using pre-trained SSD.
$ python <OBJECT_DETECTION_API_DIR>/legacy/train.py --logtostderr --pipeline_config_path=ssd_inception_v2.config --train_dir=training
<OBJECT_DETECTION_API_DIR> is the absolute path of models/research/object_detection at step1.
-
Testing logo detector.
$ python logo_detection.py --model_name logos_inference_graph/ --label_map flickr_logos_27_label_map.pbtxt --test_annot_text flickr_logos_27_dataset/flickr_logos_27_dataset_test_set_annotation_cropped.txt --test_image_dir flickr_logos_27_dataset/flickr_logos_27_dataset_images --output_dir detect_results
MIT