Analytics Vidhya

Analytics Vidhya is a community of Generative AI and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Custom Object Detection with zero code

Josh Lin
Analytics Vidhya
Published in
4 min readDec 24, 2019

--

If you want a custom Object Detection of your own, and do not have much time coding (or even not a coder), now you can use my project

Above all, let’s have a quick glance

quick glance of ease-training

So all you need are images with contents you want to detect.

Start the server

For me myself use an Ubuntu desktop, you can use OS as you like, but I’m not sure of softwares’ compatibility with others

We need docker and docker-compose to run my images

then GPU driver and nvidia-docker, I install CUDA directly which include GPU driver, anyway I need to run some machine learning directly at times.

of course git needed

then down load the code and start the service

git clone https://github.com/postor/ease-training.git
cd ease-training
. prepare.sh
docker-compose -d

then visit http://localhost:3000 or replace localhost with LAN IP, it shall look like:

home page

Prepare your custom VOC format dataset

there are lots of links about this, you can first refer this guide

I think these links will help too

after labeling your images, make sure your structure like this

xxx.zip
├── Annotations
│ └── 000001.xml
├── ImageSets
│ └── Main
│ ├── train.txt
│ └── val.txt
└── JPEGImages
└── 000001.jpg

for ease-training you need to prepare two main imagesets, which means `train.txt` contain basename of images for training, and `val.txt` for validating

let’s click `add one` inside `home` page, and upload my digger dataset to server through `create dataset` page

create dataset page

then server will train it automatically

dataset detail page

after some epoch, you can view the mean AP chart

after training the trained class files and parameters will appear in `ease-training/shared-files/params`

~/ease-training/shared-files/params/digger.zip/yolo3_darknet53_custom# ls
classes.py yolo3_darknet53_custom_best_map.log
yolo3_darknet53_custom_0000_0.0216.params yolo3_darknet53_custom_best.params
yolo3_darknet53_custom_0010_0.2489.params yolo3_darknet53_custom_train.log

you may want to modify some params for training is a intricate task, so open http://localhost:8080 and login with root:ease_training, which is a mysql admin, choose `model` table and modify the params

model table to modify params

for example you can specify --gpus=0,1 if you got two GPUs in each docker_cmd

the params’ meaning please refer https://github.com/postor/ease-training/blob/master/training/train_yolo3.py and https://github.com/postor/ease-training/blob/master/training/train_ssd.py

Detect

if you want to detect images with the params

~/ease-training-test# ls test/
11.jpg 12.jpg 17.jpg 1.jpg 7.jpg 9.jpg

you will need classes.py and yolo3_darknet53_custom_best.params

/ease-training# docker run -it — rm — gpus all -v $(pwd)/shared-files/params/digger.zip/yolo3_mobilenet0.25_custom:/training/parameters -v $(pwd)/../ease-training-test/test:/test -v $(pwd)/result:/result -v $(pwd)/shared-files/params/digger.zip/yolo3_mobilenet0.25_custom/classes.py:/training/classes.py postor/ease-training:predict — model=yolo3_mobilenet0.25 — data-shape=416 — input-folder=/test — output-folder=/result
/test/17.jpg
/test/11.jpg
/test/9.jpg
/test/12.jpg
/test/1.jpg
/test/7.jpg

in the result folder, you can see the detected object (of course if there is a good result that depands on the training process)

result image example

you may want to modify the detect code for your own use case, https://github.com/postor/ease-training/blob/master/training/predict.py

Additional

If upload picture and mark online it will be good, and start a restful API after training it will be better, I know how to make it but too much coding for me. And a public server for all to test is great, but I lack the money. So realy hope some help, coding or server.

--

--

Analytics Vidhya
Analytics Vidhya

Published in Analytics Vidhya

Analytics Vidhya is a community of Generative AI and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Josh Lin
Josh Lin

Written by Josh Lin

Looking for a job now, if you're interested reach me at postor@gmail.com

No responses yet