Ma-Dan / keras-yolo4

A Keras implementation of YOLOv4 (Tensorflow backend)
MIT License
382 stars 176 forks source link

Poor detection when trained on custom dataset #24

Open robisen1 opened 4 years ago

robisen1 commented 4 years ago

I trained from scratch a new set of weights. I used a set of data that I have used to train Yolo3 which worked well. Creating a new set of weights with train.py results in very low detection rate which does not seem to make sense.

vihari1729 commented 4 years ago

@robisen1 How did you generate annotations for your dataset, for training and validation?.

robisen1 commented 4 years ago

I used Colabler but switched to VoTT which is, in general, easier to use and faster workflow.

vihari1729 commented 4 years ago

@robisen1 Do you able to convert yolo-custom model (which you got after training your dataset) to keras model?.

farhantandia commented 4 years ago

yes, the detection becomes inconsistent in my case.

robisen1 commented 4 years ago

@robisen1 Do you able to convert yolo-custom model (which you got after training your dataset) to Keras model?.

sorry, i did not reply. I have not sure your question but I did indeed save the whole model and later turned it into a .pb. unfortunately, the model produced did not perform as well as some other code bases so I stopped researching this codebase/

prateek09101996 commented 4 years ago

@vihari1729 why do we need to convert our custom trained model to Keras as the trained model is already in .h5 keras. In my case, the trained model gave a high detection rate. But I didn't actually follow the author suggestion to convert darknet to pytorch and then to keras. I simply converted the darknet to keras and then trained my custom dataset on it.

farhantandia commented 4 years ago

@prateek09101996 how to train custom dataset using keras? Do you have the repo for it? Because if using darknet we only get .weights file not .h5. Thanks in advance.

prateek09101996 commented 4 years ago

@farhantandia. I think you can use any yolov3 conversion in any yolov3 repo. It totally converts either yolov3 or yolov4 to Keras .h5 model. I used TrainYourOwnYolo repo. Basically, it did work for other repos as well. Can anyone help me to apply this trained model for detection from the video?

vihari1729 commented 4 years ago

@vihari1729 why do we need to convert our custom trained model to Keras as the trained model is already in .h5 keras. In my case, the trained model gave a high detection rate. But I didn't actually follow the author suggestion to convert darknet to pytorch and then to keras. I simply converted the darknet to keras and then trained my custom dataset on it.

@prateek09101996 I actually used darknet repository where i got a model named yolov4.weights as output. I need to convert it to yolo.h5 to use as it said in this repository. When I am converting I got some error. So I switched to convert it into yolo.tf from other repository TheAIguy and it worked for me. I am actually doing for tracking, Not only for detection.

vihari1729 commented 4 years ago

@farhantandia. I think you can use any yolov3 conversion in any yolov3 repo. It totally converts either yolov3 or yolov4 to Keras .h5 model. I used TrainYourOwnYolo repo. Basically, it did work for other repos as well. Can anyone help me to apply this trained model for detection from the video?

I also used TrainYourOwnYolo repo and it worked good for detection. But for tracking it is not working. I think they left some architecture weights from yolov3 and did training. The raining also completed in 3 hours in my laptop. But while using darknet, for 3 classes it took almost a day for me using colaboratory

vihari1729 commented 4 years ago

yes, the detection becomes inconsistent in my case.

yes, Using trainyourownyolo repository the detection is inconsistent. But using darknet repository for training and converting to yolov4.tf model from this repository, it worked quiet well and also tracking ran smoothly. In case if you want only detection, you can keep "tracking=false" as they said from the repository

farhantandia commented 4 years ago

@vihari1729 thanks, so we can use .tf instead of .h5 as refers to AIguy repo to do such tracking right? deepsort id?

vihari1729 commented 4 years ago

@farhantandia yes both are similar. But I preferred converting to .tf model because it has github repository with instructions to convert.

prateek09101996 commented 4 years ago

@vihari1729 - I originally converted darknet weights to Keras and then trained using the instruction in this repo. While training in one class, it did take me 2 days to train on GPU but the map was quite high and detection for images is good too. Thanks for your brief review, I would too like to convert it to .tf and check for tracking if it helps.

prateek09101996 commented 4 years ago

@vihari1729 - did you use TrainYourOwnYolo for training as well? I suggest using that repo just for converting yolov4.weights to yolov4.h5 and then proceed to train for this repo. The training takes lot of time even on multiple GPUs.

farhantandia commented 4 years ago

@vihari1729 - In that repo only can be used for yolov3, I got an error reshaped while converting the yolov4-tiny.weights, so which part that did you modified?

farhantandia commented 4 years ago

@vihari1729 -btw theAIGuy repo just updated a new repo for yolov4-deep sort yesterday, so it can run now. thanks.

vihari1729 commented 4 years ago

@vihari1729 - did you use TrainYourOwnYolo for training as well? I suggest using that repo just for converting yolov4.weights to yolov4.h5 and then proceed to train for this repo. The training takes lot of time even on multiple GPUs.

@prateek09101996 yes i have used. But it is only working for detection. so I shifted to THeAIGuy repository

vihari1729 commented 4 years ago

@vihari1729 - In that repo only can be used for yolov3, I got an error reshaped while converting the yolov4-tiny.weights, so which part that did you modified?

@farhantandia I modified it on my own by doing some changes.luckily you are telling that they opened for yolov4-deepsort. So use that repository.