keras-yolo4 icon indicating copy to clipboard operation
keras-yolo4 copied to clipboard

Poor detection when trained on custom dataset

Open robisen1 opened this issue 4 years ago • 19 comments

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.

robisen1 avatar Jun 08 '20 03:06 robisen1

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

vihari1729 avatar Jun 17 '20 13:06 vihari1729

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

robisen1 avatar Jun 17 '20 17:06 robisen1

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

vihari1729 avatar Jun 19 '20 01:06 vihari1729

yes, the detection becomes inconsistent in my case.

farhantandia avatar Jul 20 '20 11:07 farhantandia

@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/

robisen1 avatar Jul 26 '20 21:07 robisen1

@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 avatar Aug 16 '20 20:08 prateek09101996

@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.

farhantandia avatar Aug 17 '20 00:08 farhantandia

@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?

prateek09101996 avatar Aug 17 '20 01:08 prateek09101996

@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 avatar Aug 17 '20 05:08 vihari1729

@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 avatar Aug 17 '20 05:08 vihari1729

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

vihari1729 avatar Aug 17 '20 05:08 vihari1729

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

farhantandia avatar Aug 17 '20 06:08 farhantandia

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

vihari1729 avatar Aug 17 '20 06:08 vihari1729

@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 avatar Aug 17 '20 15:08 prateek09101996

@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 avatar Aug 17 '20 16:08 prateek09101996

@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 avatar Aug 18 '20 01:08 farhantandia

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

farhantandia avatar Aug 18 '20 07:08 farhantandia

@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 avatar Aug 18 '20 09:08 vihari1729

@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.

vihari1729 avatar Aug 18 '20 09:08 vihari1729