Closed sudhanv09 closed 3 years ago
Sorry, I am not so familiar with ROS. By maybe somebody else can help you out here. Good luck!
I'm sorry for not making it clear. My problem is with deepsort and not ROS.
In deep_sort/sort/tracker.py I observe that I'm stuck in _initiate_track function and self.tracks is not updating. The is_tentative function of Track gives True and never updates
A track is in Tentative
state until the object has been associated n_init
consecutive times. How are you feeding the images to track.py
?
# image going to YOLO as tensor (BCHW)
img = torch.from_numpy(image).to(device)
img = img.half() if half else img.float()
img /= 255.0
if img.ndimension() == 3:
img = img.unsqueeze(0)
assert img.shape == (1,3,480,640)
# image going to deepsort (HWC) (480, 640, 3)
image = image.transpose(1, 2, 0)
# Inference
pred = model(img, augment=augment)[0]
# Apply NMS
pred = non_max_suppression(pred, conf_thres, iou_thres, agnostic=agnostic_nms)
for _, det in enumerate(pred):
if det is not None and len(det):
det[:, :4] = scale_coords(
img.shape[2:], det[:, :4], image.shape).round()
for c in det[:, -1].unique():
n = (det[:, -1] == c).sum() # detections per class
final_out[names[int(c)]] = n
xywh_bboxs = []
confs = []
for *xyxy, conf, _ in det:
x_c, y_c, bbox_w, bbox_h = xyxy_to_xywh(*xyxy)
xywh_obj = [x_c, y_c, bbox_w, bbox_h]
xywh_bboxs.append(xywh_obj)
confs.append([conf.item()])
xywhs = torch.Tensor(xywh_bboxs)
confss = torch.Tensor(confs)
outputs = deepsort.update(xywhs, confss, image)
# print(f'out: {outputs}')
if len(outputs) > 0:
bbox_xyxy = outputs[:, :4]
identities = outputs[:, -1]
draw_boxes(image, bbox_xyxy, identities)
# to MOT format
tlwh_bboxs = xyxy_to_tlwh(bbox_xyxy)
else:
deepsort.increment_ages()
return final_out, tlwh_bboxs
images are fed from ROS. theres no problem there. Can you see something off here
I have the feeling that maybe only a single image is feed to yolo. It makes no sense otherwise that the tracks get stuck in tentative. Either they should be deleted or accepted as valid tracks if there is a continuous stream of images. What do you feed to:
?
Actually I'm not using this line. I feed my images directly to the loop. So the webcam uploads to ROS and then I get the images from ROS.
"I have the feeling that maybe only a single image is feed to yolo." This could be the case. I'll check it out
Hi I am attempting to port this repo to ROS. I am having trouble with deepsort, it is stuck in tentative. Can you help me sort this out