Skip to content

truskovskiyk/logos.tensorflow

Repository files navigation

logos.tensorflow

The Problem

We would like to detect brand logos in an image.

TODO

  • Project setup
  • Data Preprocessing
  • Train models
  • Save results
  • Write readme with results
  • Add training plots to readme
  • Tests
  • CI/CD
  • API
  • Deploy
  • Train with distractor logo images

Setup Project

I recommended use docker and work inside container

docker build -f ./dockerfiles/gpu/Dockerfile -t logost.tensorflow .
nvidia-docker run -it -v $PWD:/code --net=host --ipc=host logost.tensorflow:latest /bin/bash

Dataset

You can find origin dataset here Also you can download my train/val/test split with tf.records here

Or you can create your own dataset

mkdir dataset
./scripts/load_data.sh
python ./logos/data_preprocessing.py
python ./logos/create_tf_records.py

Results

name speed (ms) train mAP val mAP test images pipeline checkpoints
0 ssd_mobilenet_v1 30 0.9088 0.6811 load pipeline load
1 ssd_mobilenet_v1_focal_loss 30 0.9518 0.671 load pipeline load
2 faster_rcnn_resnet50 89 0.9893 0.7395 load pipeline load

Commands for tensorflow object detection API

Parameters

export PATH_TO_YOUR_PIPELINE_CONFIG=...
export PATH_TO_TRAIN_DIR=...
export PATH_TO_EVAL_DIR=...
export TRAIN_PATH=...
export EXPORT_DIR=...

Train/Eval/Export model

python object_detection/train.py \
    --logtostderr \
    --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \
    --train_dir={PATH_TO_TRAIN_DIR}

python object_detection/eval.py \
    --logtostderr \
    --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \
    --checkpoint_dir=${PATH_TO_TRAIN_DIR} \
    --eval_dir=${PATH_TO_TRAIN_DIR}

python object_detection/export_inference_graph.py \
    --input_type image_tensor \
    --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \
    --trained_checkpoint_prefix=${TRAIN_PATH} \
    --output_directory=${EXPORT_DIR}

References