kaylode / vehicle-counting

Vehicle counting using Pytorch
MIT License
95 stars 32 forks source link

how to put custom weight? #8

Closed pouoq34 closed 2 years ago

pouoq34 commented 2 years ago

Hello kaylode! First, Thank you for sharing your project :) It is a really helpful idea for me!

I customized labels and could get customized yolo v5 weights files(best.pt). I have tried your code using my custom weights and video but it was failde :(

When I run code without weight value. It works (but it is not result what i expected ) like this (python run.py --input_path="./cam_04.mp4" --output_path="~" )

When I run code with weight value, It shows error :(
(python run.py --input_path="./cam_04.mp4" --output_path="~" --weight="./best.pt")

image

you mentioned 3 things in "Start inference: Define these things before run"

as I undertood,

Am I right?

I'll wait for your reply. Again Thanks for the good research.

kaylode commented 2 years ago

Hi @pouoq34, thank you for your comment :) For your questions:

path to street annotation files in configs/cam_configs.yaml --> i can resize street size(zone) by modifying cam_configs.yaml

You can resize the street zone and modify it yourself, but NOT by modifying cam_configs.yaml . To accomplish this, look into the zone_path argument in that file, which have demo/sample value by default. You can specify this value to your specific folder in which contains camera polygons/zones. For the format of these polygons, see demo/sample/cam_04.json for example. To change the zone size or shape, change the value for points field in the json file.

path to video file --> check my video file path

Your path is correct, I think

model's checkpoint -> replace "vehicle-counting/models/deepsort/deep/checkpoint/ckpt.t7" with "customized deepsort model result(checkpint/ckpt.t7)"

Yes, if you want to use your own deepsort checkpoint. But the default deepsort checkpoint also works well (although it was trained on human dataset, not vehicle)

I customized labels and could get customized yolo v5 weights files(best.pt). I have tried your code using my custom weights and video but it was failde :(

For now, the trained yolov5 checkpoint is not compatible with this repo. However, I will provide a checkpoint conversion script soon. If you really want to do this yourself, I give a workaround in #6.

But the error that you faced as in the image maybe due to your timm version on your local machine. Reply from efficientdet author: link.