hhk7734 / tensorflow-yolov4

YOLOv4 Implemented in Tensorflow 2.
MIT License
136 stars 75 forks source link

detect customer class id #30

Closed RuikunLi closed 3 years ago

RuikunLi commented 3 years ago

Hi, I would like to know if it is possible to detect customer class id.

For example, I only interest in the person in an image, is it possible to only detect the person and draw the person bboxes?

thx in advance

hhk7734 commented 3 years ago

There are many same requests, so when the time comes, I will write and upload a guideline to train only the classes I want in Coco.

hhk7734 commented 3 years ago

Download

train2017.zip (images) http://images.cocodataset.org/zips/train2017.zip val2017.zip (images) http://images.cocodataset.org/zips/val2017.zip instances_train2017.json, instances_val2017.json http://images.cocodataset.org/annotations/annotations_trainval2017.zip

Create custom .names file and dataset file

Ref: https://wiki.loliot.net/docs/lang/python/libraries/yolov4/python-yolov4-dataset

Copy the conversion script in the above link.

INSTANCES_PATH = "instances_train2017.json"
NAMES_PATH = "custom.names"
OUTPUT_FILE_PATH = "custom_train2017.txt"

After editing the above part of the script, run the script for train and val respectively. Then, you can get custom_train2017.txt and custom_val2017.txt. It will probably take an hour or two.

Train

Ref: https://wiki.loliot.net/docs/lang/python/libraries/yolov4/python-yolov4-training

Set epochs to the number of classes * 5 or more.