obendidi / Tracking-with-darkflow

Real-time people Multitracker using YOLO v2 and deep_sort with tensorflow
GNU General Public License v3.0
524 stars 174 forks source link

Getting all detections #4

Closed arevel190 closed 7 years ago

arevel190 commented 7 years ago

Hi,

I would like to know if there is a way to get the other detections as well while getting the people count? I am interested in having a way to get info on the context (no need to be tracked), as well as the unique number of people.

Thanks a lot for your help.

obendidi commented 7 years ago

to get all detection + the people tracking, you can just change this line in darkflow to something like this :

if self.FLAGS.trackObj != mess :
       cv2.rectangle(imgcv,
            (left, top), (right, bot),
            colors[max_indx], thick)
       cv2.putText(imgcv, mess, (left, top - 12),
            0, 1e-3 * h, colors[max_indx],thick//3)
       continue

it will draw the other objects in the image as well.

arevel190 commented 7 years ago

@bendidi Awesome, thanks. Also, is there a way to output in real time (via txt or csv file) the last ID number detected?

obendidi commented 7 years ago

here is the line where it writes to a csv each new box ID+ frame number + box coordinate in pixels

and as I've said here in one of my answers :

you can set the csv FLAG to true it will write at run time the ID number and the corresponding box in a csv file as mentioned in ReadMe :

csv : save csv file of detections in the format (frame_id,object_id,x,y,w,h)

arevel190 commented 7 years ago

@bendidi Thanks again for your prompt reply. I tested this solution, but the csv table is only populated after the program has been stopped. I meant to output real time data, like a stream of values or a csv file that is constantly being populated by the new IDs.

obendidi commented 7 years ago

it should be fixed with the last commit :+1:

arevel190 commented 7 years ago

@bendidi For some reason after your update I am getting a 404 error on the github repo (the darkflow folder to be specific), and it is not updating. Once again thank you very much!

arevel190 commented 7 years ago

I just double checked and the folder is up again. Now there is another error that is being generated:

_Traceback (most recent call last): File "run.py", line 3, in from darkflow.darkflow.net.build import TFNet File "/Users/pedareva1/Tracking-with-darkflow/darkflow/darkflow/net/build.py", line 7, in from .framework import create_framework File "/Users/pedareva1/Tracking-with-darkflow/darkflow/darkflow/net/framework.py", line 2, in from . import yolov2 File "/Users/pedareva1/Tracking-with-darkflow/darkflow/darkflow/net/yolov2/init.py", line 2, in from . import predict File "/Users/pedareva1/Tracking-with-darkflow/darkflow/darkflow/net/yolov2/predict.py", line 134 csvfile.flush() ^ TabError: inconsistent use of tabs and spaces in indentation

(Sorry for asking too many questions).

arevel190 commented 7 years ago

I just checked and could solve the error by converting indentation to spaces. Now another error pops up:

_Traceback (most recent call last): File "run.py", line 27, in tfnet.camera() File "/home/pedareva1/Tracking-with-darkflow/darkflow/darkflow/net/help.py", line 107, in camera writer.writerow(['frame_id', 'trackid' , 'x', 'y', 'w', 'h']) TypeError: a bytes-like object is required, not 'str'

I would really appreciate your help with this.

obendidi commented 7 years ago

in line 106 of darkflow/darkflow/net/help.py , just change the 'wb' to 'w' , I'll make the change in the repo later

It's a problem that happens when using python 3 , when I tested last time it was with python 2 ^^

arevel190 commented 7 years ago

@bendidi Awesome, thanks a lot!