Pretrained model weights can download by : https://pan.baidu.com/s/194R9U3bJVCd4gM4vYPSp1g, verified code is: yolo. In downloaded weights: "epoch100-loss12.122-val_loss12.702.h5" should be placed in "facial_mask/models" directory, **"yolo4_voc_weights.h5" ** and "yolo4_weights.h5" should be placed in "model_data" directory.
$ python 01_detect_from_image.py
Results are saved to ./images/detected/
.
FIrstly, you should preparing your custom dataset. Our model need Pascal VOC format for image annotation. You can generate this annotation for your images using the easy to use LabelImg image annotation tool. See: https://github.com/tzutalin/labelImg.
The structure of your image dataset folder should look like below (placing in root of "yolov4" directory):
. >> dataset_directory >> images >> img_1.jpg
>> img_2.jpg
>> img_3.jpg
>> annotations >> img_1.xml
>> img_2.xml
>> img_3.xml
After that, editing 04_custom_training.py with your custom configuration:
path_to_model = "model_data/yolo4_weights.h5"
trainer = Custom_Object_Detect_Training()
trainer.setDataDirectory(data_directory="dataset_diretory", object_names=["names"])
trainer.setTrainConfig(batch_size=2, epochs=100, pretrain_model=path_to_model)
trainer.trainModel()
Results will be saved in "dataset_diretory/models" diretory. Then you can use trained weights for your custom detecting.
Issues should be raised directly in the repository. For more details can email me at 156618056@qq.com.