npq-thien / Vehicle_Detection_and_Counting_System

Building a small demo system to detect and count vehicle using Streamlit framework
GNU General Public License v3.0
19 stars 5 forks source link

Error #3

Closed helios78971 closed 1 year ago

helios78971 commented 1 year ago

Hello i was trying to use a model from custom object training with the same object but different class name and i get this error

TypeError: detect() missing 8 required positional arguments: 'stframe', 'car', 'bus', 'truck', 'motor', 'line', 'fps_rate', and 'class_id'

can you help me with this please?

npq-thien commented 1 year ago

Have you solved it yet ?

helios78971 commented 1 year ago

yes hehe, it turn out to be my mistake, i try to test the project not from the demo.py but from track.py directly, and it gives me the error. i am really sorry if i disturb you by opening an issue and then suddenly close it, i still trying to understand the code your created and to directly use it without the streamlit, and can i ask you a question, how do you get the yolov5 model so good? how much dataset you use and do you custom the hyperparameter?

npq-thien commented 1 year ago

I don't think my model is good enough. I trained with yolov5n (the smallest size of YOLOv5), I have to trade-off between the fps and the accuracy. Well, this is the link of my dataset: https://drive.google.com/drive/u/1/folders/1gtym6xZNZVa8rD9UZfhkoQgMUHAScJ4x This dataset has about 1500 images, but it has few bus. No, I don't custom any hyperparameter, here is my training code: !python train.py --img 640 --batch 64 --epochs 20 --data custom_data.yaml --weights 'yolov5n.pt'

If you want to know better about my code, my project based on this video: https://www.youtube.com/watch?v=7gz3vUmy0C0&t=1692s&ab_channel=AI4LIFE

helios78971 commented 1 year ago

I see that you and I have watch the same youtube video hahahaha. I was wondering, I use 5000 images from OID but when I train it with YOLOv5m, it have a bad accuracy, below 50%. Do you know maybe why this happen?

npq-thien commented 1 year ago

I don't know what is OID ? Is that Open Images Dataset ? You can try to train with different datasets. Maybe the problem comes from your dataset: how many instances per class ? Is the dataset balanced ? If the images you train and test are different you may get bad accuracy on the test set. Or maybe you didn't train enough epochs ?

helios78971 commented 1 year ago

Yes, OID is Open Image Dataset, after I check the dataset your using, I think the problem is from my dataset, because the image in OID is not from the CCTV view, so it is hard to recognize the object I want to detect, I probably will use some of your dataset, if it's okay with you and try to combine with my dataset, so it has good accuracy

npq-thien commented 1 year ago

Sure, feel free to use my dataset. Good luck !!