ahmetozlu / tensorflow_object_counting_api

🚀 The TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems!
https://www.youtube.com/watch?v=yT_1eKJTdfk
MIT License
1.32k stars 545 forks source link

How to use vehicle_counting.py #92

Open Hatem-Jr opened 3 years ago

Hatem-Jr commented 3 years ago

Hi, the following files are my custom model to detect "mice" I also have the frozen.pb file although not sure if that's equivalent to frozen_inference_graph.pb

This is the .weights file I downloaded and converted through the repo before "EDIT 1": https://drive.google.com/file/d/1GKVQipCa9q3Vk10yF78AR2Ip0GOe_2Ib/view

Screenshot 2021-07-22 132416 Screenshot 2021-07-22 132111

what I want to do is count how many times the mouse crossed the line (a type of test analysis) but I'm not sure which parts of vehicle_counting.py to edit, specifically the 'mscoco_label_map.pbtxt' field in line 17, do I change it or keep it that way? specially if I have to add something like this in it: item { name: "/m/01g317" id: 1 display_name: "person" } I obviously don't know the "name" or is there a way to know that ?

Also if you are wondering how I got the custom model files I converted a custom yolov3.weights file from this repo: https://github.com/mystic123/tensorflow-yolo-v3 and it produced all the files in the screenshots

EDIT 1: I tried to run it using the frozen_inference_graph.pb file in the screenshots but this error happened: Traceback (most recent call last): File "d:/custom code/tensorflow_object_counting_api/vehicle_counting.py", line 18, in 'D:/custom code/tensorflow_object_counting_api/data/pet_label_map.pbtxt') File "d:\custom code\tensorflow_object_counting_api\utils\backbone.py", line 40, in set_model serialized_graph = fid.read() File "C:\Users\Owner\anaconda3\envs\labelme\lib\site-packages\tensorflow_core\python\lib\io\file_io.py", line 122, in read self._preread_check() File "C:\Users\Owner\anaconda3\envs\labelme\lib\site-packages\tensorflow_core\python\lib\io\file_io.py", line 84, in _preread_check compat.as_bytes(self.__name), 1024 * 512) tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: ssd_mobilenet_v1_coco_2018_01_28/frozen_inference_graph.pb : The system cannot find the file specified. ; No such file or directory

ALSO I changed the .pbtxt file to pet_label_map.pbtxt and added an item in it: item { id: 38 name: 'mice' }