naisy / realtime_object_detection

Plug and Play Real-Time Object Detection App with Tensorflow and OpenCV. No Bugs No Worries. Enjoy!
MIT License
101 stars 36 forks source link

Increase Batch Size to support multiple cameras #68

Closed anandcu3 closed 5 years ago

anandcu3 commented 5 years ago

Is it possible to increase batch size to support multiple frames simultaneously. Thanks

naisy commented 5 years ago

Hi @anandcu3,

Sorry, this repository does not consider simultaneous processing of multiple frames.

anandcu3 commented 5 years ago

@naisy Thanks for the quick info. Is it possible to edit the SessionWorker to accommodate multiple frames?

naisy commented 5 years ago

Hi @anandcu3,

There is no need to edit SessionWorker. You will need to edit lib/detection_nms_v2.py.

Only one frame is set to image_expanded that becomes input of SessionWorker. You will need to change this to multiple frames. image_expanded = np.expand_dims(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB), axis=0) # np.expand_dims is faster than []

After getting the output of SessionWorker, you will need to rewrite significantly after next line. boxes, scores, classes = np.squeeze(boxes), np.squeeze(scores), np.squeeze(classes)