sefaburakokcu / yolov3-facial-landmark-detection

Yolov3-facial-landmark-detection
8 stars 1 forks source link

How to train my own dataset? #3

Closed Cc47 closed 3 years ago

Cc47 commented 3 years ago

Hi! It is my honor to see your achivement! I want to ask you a question about how to train my own fish dataset instead of people face dataset? What should I change in your codes? I would appreciate it if you could tell me ! Thanks!

sefaburakokcu commented 3 years ago

Hi, thank you! What are your labels? Are they only bounding boxes or bounding boxes with additional key points such as head, tail points? If you want to only detect bounding boxes for fishes, yolov5 is more suitable for your purpose.

Cc47 commented 3 years ago

Hi, thank you! What are your labels? Are they only bounding boxes or bounding boxes with additional key points such as head, tail points? If you want to only detect bounding boxes for fishes, yolov5 is more suitable for your purpose.

Yeah!I want to detect fish key points such as head and tail points,and I have hundreds of labels.But I don't know how to train them without pretrained people face weights,thanks for your answer.

Cc47 commented 3 years ago

I can't wait to receive your reply!I want to know how to choose "weights" and '--backbone_weights' in train.py?Because I want to detect fish head points and tail points,it will be wrong if I use people-face-weights.Can you give me some advice?Thanks!

sefaburakokcu commented 3 years ago

Sorry for the delay. You can pass empty string("") to "weights" and "backbone_weights", which will initialize weights randomly. "weights" parameter is used for resuming or finetuning a previously trained model. "backbone_weights" is for loading pretrained weights of backbone architectures such as mobilenetv2 or mobilenetv3, which are trained on imagenet.

In order to train model with your custom dataset, you scan follow steps below:

This repo is cretaed for predicting bounding boxes with 5 key points. At the weekend, I am planning to make the number of keypoints parametric instead of fixed 5.

Cc47 commented 3 years ago

Sorry for the delay. You can pass empty string("") to "weights" and "backbone_weights", which will initialize weights randomly. "weights" parameter is used for resuming or finetuning a previously trained model. "backbone_weights" is for loading pretrained weights of backbone architectures such as mobilenetv2 or mobilenetv3, which are trained on imagenet.

In order to train model with your custom dataset, you scan follow steps below:

  • Image and label files should be found in the same folder.
  • There should be one label file which has a same name with an image file for each image. For example, if image name is "image_1.jpg", label file name should be "image_1.txt".
  • Each label file should use yolo format. That is, each line in the file contains one space separated labels for each object. It should contain class index(c), x coordinate of top left corner, y coordinate of top left corner, object width(w), object height(h), (x y) coordinates of each key points. Each x coordinate should be scaled with image width whereas each y coordinate should be scaled with image height. An example is given below. yolo_format

This repo is cretaed for predicting bounding boxes with 5 key points. At the weekend, I am planning to make the number of keypoints parametric instead of fixed 5.

Thanks for your help and patience!I am waiting for your achivement!!!

Cc47 commented 3 years ago

Hey bro! I tried using the way you told me,but I can't get an expected fish-point-picture.I an sure all labels and images are right,and I use the "darknet53" net to train my datasets.I really eager to know if I need to change net structure?If yes,how should I change and which codes need to be changed?Sir,I'm sorry to bother you,but I really need your help to give me some inspiration,I'm afraid that I couldn't finish the work from my teacher. image image

sefaburakokcu commented 3 years ago

The results seem promising. You might try 'mbv2_1', 'mbv2_75' or 'mbv3_small_1' networks instead of 'darkenet53'. I think that you may have limited labels. Therefore, a smaller architecture is more suitable for you. Also, there might be a bug in my implementation for darknet53.

Cc47 commented 3 years ago

https://github.com/ouyanghuiyu/yolo-face-with-landmark The result is from this git.I can't find out why several fish are not detected.I used "mbv3_small" net and suit pretrained weights,but I can't get good results.I have 200 pictures and labels and I think it is enough,because it's very nice when I used yolov3 to detect only fish-box .However, I can't find other fish-box by training this project.I am very confused now!

573b0c75a2aff181788fc85ae1527a5

sefaburakokcu commented 3 years ago

Which yolov3 repository did you use for detecting only bounding boxes for fishes? Maybe, it applies some augmentations to training dataset. Also, key points might be one reason why detection performance is lower. You can pass 'store_false' to - - muti-scale parameter for training with multi-scale augmentation, which may increase performance of your model.

Cc47 commented 3 years ago

Thanks! I want to ask you one more question.I used this repository https://github.com/ouyanghuiyu/yolo-face-with-landmark to train single fish and get good results(as shown in illustration),why does it get worse when I train many fish? How should I change in codes to train multi-objective points?Do you mind giving me a convenient contact way so that we can communicate easier?Anyway,thanks bro! image

sefaburakokcu commented 3 years ago

Yo can contact me on Telegram.

Cc47 commented 3 years ago

Thanks.I have created my telegram account and talked with you but the message is failed to send.Please pass my require.And my username is @chenglaobai

sefaburakokcu commented 3 years ago

It is solved and closed.