Open ridhimagarg opened 5 years ago
Hey Ridhima, thanks for your question and sorry for late reply. Actually to detect the bounding boxes you have to play with the below piece of code. Try changing params of cv2.ractangle()
and cv2.putText()
and see if it works. Try changing the color, increasing the thickness of the ractangle, changing the font of the text or size of text.
# add the box and label and display it img = cv2.rectangle(img, tl, br, (0, 255, 0), 7) # draw a ractangle onto an image img = cv2.putText(img, label, tl, cv2.FONT_HERSHEY_COMPLEX, 1, (0, 0, 0), 2) # add laebl name plt.imshow(img) plt.show()
Let me know if you get further issues.
@ratulKabir , hello! The same to @ri-dhimagarg1, I trained on my dataset(840 images of 3 class objects, bottle/ mouse/ pen), modify model tiny-yolo-3c.cfg , batch 8, use the default lr, gpu model(GTX 950M 2GB), about 10k steps(about 300 epoches more than 10 hours), loss about 3 or 2, move ave loss the same, but the bounding box is not correct on train image( threshold is 0.0045), they are so many boxes or no boxes on high threshold, how to solve it? And I want to know how many pictures in your dataset, which kind of pictures in your dataset(complex background / single big object or else?) how many hours you train, how big the loss, and are you change the code in darkflow folder? Could you give some suggestions, I can't find where the problems.
Hey Jack,
Threshold 0.0045 is too low I think for a dataset with 840 images and the other descriptions that you added. Can you tell me for which threshold value for which you did not get any box at all? I think you should you try with threshold values between 0.05 - 0.5 and try to keep the loss less than 1. Try different threshold values to improve confidence factor on image boxes.
Also I am not sure how changing the batch size to 8 will help the model here. Although you can try different batch sizes and see if it improves the time needed to train and may be the performance, experimenting is the best way of learning after all.
If you read carefully, you can find information about my dataset and stuff in the readme file. However I have copied the lines here:- "My confidence factor is low because of lack of data (about 250 images) and having no GPU. I had to stop training after 60 epochs. It took 9 hours and the lose was around 3.8. I was just trying to learn things so that was enough for me. I recommend keeping the loss less than 1." For now my advise is to keep the background of the images easy, not too much noisy.
I would ask you to go through the Train your own dataset
part carefully and understand the information.
I really appreciate your questions. Try again and let me know if you encounter further problems. Also I would appreciate if you can suggest any improvements.
Greetings, Ratul
@ratulKabir
I'm excited receiving your advices, you are the first guy reply me!
I use --json
to look up the all "confidence", they are all at 0.17 no mater what object. is it underfiting or overfiting?
Then I test the net's coverage or not, I detect "sports ball", I use only 1 image that scene is Jordan crossover O'Neal at NBA court, a basketball in Jordan's hand, I use lr = 1e-06
and no less than 1e-07
, load pretrained weights yolov2-tiny.weights
, at start the loss about 106
, use 3100 steps. I test 3 images during the train until it end, the 1st is the train image; the 2nd is kids in soccer field 3 orange soccer balls, 2 white, 1 red; 3rd is a soccer player with a white soccer ball, background no much noise.
I see the json files of those detections, the "confidence"
are [0.49, 0.54] at last(the confidence only keep 2 decimal maybe approximate calculate long decimal), the default threshold is 0.5
, bounding boxes in images are coverage to the balls, 1st image to the ball in Jordan's hand(about 10 boxes); 2nd to the 3 orange balls(I think they are like the basketball), and some error b-boxes; 3rd just reduce the quantity of b-boxes. And the strange thing(in my view) is the step 3100
, - loss 103.52783203125
, - moving ave loss 103.49497615101302
. If I turn down the threshold to 0.48
, there are full of b-boxes on those images(in my head l'm luck to use default threshold :) ).
After that with your suggestions I guess I made the dataset as will or chosen a wrong threshold in 840 dataset detection(not lucky as "sports ball" detection, it's hard to choose in all confidence is 0.17), I will change some images in the big dataset and try again(if I have enough time).
And I got some tutorials in those URL: Mark Jay's video: https://www.youtube.com/watch?v=PyjBd7IDYZs&list=PLX-LrBk6h3wSGvuTnxB2Kj358XfctL4BM Some advices by thtrieu(Darkflow builder) in 2017: https://github.com/thtrieu/darkflow/issues/80 Extension of Darkflow: https://github.com/thtrieu/darkflow/issues/264
Thank you again for replying me! A clumsy student, Jack
those images in the dataset WIDER Face
: http://shuoyang1213.me/WIDERFACE/
Hi,
I followed the same procedure as yours, I am able to train my model successfully but not able to detect the bounding box or any detections you can say.
I kept using default values for learning rate, batch size.
I changed the no. of epochs to 300. I have 150 images of only 1 class. I modified the .cfg file as well.
Please give some suggestions. After setting the threshold to 0.0001 getting too many bounding box. Give suggestions, how to overcome this problem.