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

one line code in yolo2/predict.py #25

Closed ifangcheng closed 6 years ago

ifangcheng commented 6 years ago

def extract_boxes(self,new_im): cont = [] new_im=new_im.astype(np.uint8) ret, thresh=cv2.threshold(new_im, 127, 255, 0) p, contours, hierarchy=cv2.findContours( thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) for i in range(0, len(contours)): cnt=contours[i] x, y, w, h=cv2.boundingRect(cnt) if w*h > 30**2 and ((w < new_im.shape[0] and h <= new_im.shape[1]) or (w <= new_im.shape[0] and h < new_im.shape[1])): if self.FLAGS.tracker == "sort": cont.append([x, y, x+w, y+h]) else : cont.append([x, y, x, y]) return cont

this line else : cont.append([x, y, x, y]) is correct? or should be else : cont.append([x, y, x, y])

ifangcheng commented 6 years ago

or should be else : cont.append([x, y, w, h]) ?

obendidi commented 6 years ago

yes, my mistake , you can make a Pull request if you want or I'll just fix it directly

ifangcheng commented 6 years ago

@bendidi thanks for response! i think you can fix it directly :-D

obendidi commented 6 years ago

fixed , thanks !