Open ShipAnita opened 1 year ago
兄弟,你那个咋样了,我也用yolov8替换了,我感觉效果不如v5呢
Hello, I would like to ask if you have such a problem during replacement? for j in range(len(yolo_preds.pred)): AttributeError: 'list' object has no attribute 'pred' How to solve this problem?
You can try debugging to view internal data changes. The main reason is that the output results of YOLOv5 and YOLOv8 are not in the same format, and YOLOv8's output does not include the prefix option. If you need it, I can show you the changes.
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午3:02 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31)
Hello, I would like to ask if you have such a problem during replacement? for j in range(len(yolo_preds.pred)): AttributeError: 'list' object has no attribute 'pred' How to solve this problem?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
You can try debugging to view internal data changes. The main reason is that the output results of YOLOv5 and YOLOv8 are not in the same format, and YOLOv8's output does not include the prefix option. If you need it, I can show you the changes. … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午3:02 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31) Hello, I would like to ask if you have such a problem during replacement? for j in range(len(yolo_preds.pred)): AttributeError: 'list' object has no attribute 'pred' How to solve this problem? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Thank you very much for your reply. I am now trying to modify the input of deepsort_update, but I have not been able to do it. I wonder if you have time to show it to me. 非常感谢您的回复。我现在正在尝试修改deepsort_update的输入,但一直没能做到。我不知道你是否有时间给我展示一下。
while not cap.end: ret, img = cap.read() if not ret: continue results = model([img]) predicts_xyxy = [] for result in results: yolo_deepsort.ims = result.orig_img yolo_deepsort.names = result.names yolo_deepsort.shape = result.boxes.shape yolo_deepsort.pred = result.boxes.conf for info in result.boxes.data: x1, y1, x2, y2, score, class_id = info
x, y, w, h = xyxy2xywh(x1, y1, x2, y2)
predicts_xyxy.append([float(x), float(y), float(w), float(h), float(score), int(class_id), int(0)])
predicts_xyxy = np.array(predicts_xyxy)
deepsort_outputs = []
# for j in range(len(predicts_xyxy)):
if len(predicts_xyxy) == 0:
continue
xywh = torch.tensor(predicts_xyxy[:, :4])
temp = deepsort_update(deepsort_tracker, torch.tensor(predicts_xyxy), xywh, img)
# print(temp)
if len(temp) == 0:
temp = np.ones((0, 8))
deepsort_outputs.append(temp.astype(np.float32))
yolo_deepsort.pred = deepsort_outputs
if len(cap.stack) == 25:
print(f"processing {cap.idx // 25}th second clips")
clip = cap.get_video_clip()
if yolo_deepsort.shape[0]:
inputs, inp_boxes, _ = ava_inference_transform(clip, yolo_deepsort.pred[0][:, 0:4],
crop_size=imsize)
inp_boxes = torch.cat([torch.zeros(inp_boxes.shape[0], 1), inp_boxes], dim=1)
if isinstance(inputs, list):
inputs = [inp.unsqueeze(0).to(device) for inp in inputs]
else:
inputs = inputs.unqueeze(0).to(device)
with torch.no_grad():
slowfast_predicts = video_model(inputs, inp_boxes.to(device))
slowfast_predicts = slowfast_predicts.cpu()
for tid, ava_label in zip(yolo_deepsort.pred[0][:, 5].tolist(),
np.argmax(slowfast_predicts, axis=1).tolist()):
id_to_ava_labels[tid] = ava_label_names[ava_label + 1]
save_predicts_to_video(yolo_deepsort, id_to_ava_labels, coco_color_map, output_video, config.show)
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午4:39 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31)
You can try debugging to view internal data changes. The main reason is that the output results of YOLOv5 and YOLOv8 are not in the same format, and YOLOv8's output does not include the prefix option. If you need it, I can show you the changes. … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午3:02 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31) Hello, I would like to ask if you have such a problem during replacement? for j in range(len(yolo_preds.pred)): AttributeError: 'list' object has no attribute 'pred' How to solve this problem? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Thank you very much for your reply. I am now trying to modify the input of deepsort_update, but I have not been able to do it. I wonder if you have time to show it to me. 非常感谢您的回复。我现在正在尝试修改deepsort_update的输入,但一直没能做到。我不知道你是否有时间给我展示一下。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
while not cap.end: ret, img = cap.read() if not ret: continue results = model([img]) predicts_xyxy = [] for result in results: yolo_deepsort.ims = result.orig_img yolo_deepsort.names = result.names yolo_deepsort.shape = result.boxes.shape yolo_deepsort.pred = result.boxes.conf for info in result.boxes.data: x1, y1, x2, y2, score, class_id = info # xyxy to xywh x, y, w, h = xyxy2xywh(x1, y1, x2, y2) predicts_xyxy.append([float(x), float(y), float(w), float(h), float(score), int(class_id), int(0)]) predicts_xyxy = np.array(predicts_xyxy) deepsort_outputs = [] # for j in range(len(predicts_xyxy)): if len(predicts_xyxy) == 0: continue xywh = torch.tensor(predicts_xyxy[:, :4]) temp = deepsort_update(deepsort_tracker, torch.tensor(predicts_xyxy), xywh, img) # print(temp) if len(temp) == 0: temp = np.ones((0, 8)) deepsort_outputs.append(temp.astype(np.float32)) yolo_deepsort.pred = deepsort_outputs if len(cap.stack) == 25: print(f"processing {cap.idx // 25}th second clips") clip = cap.get_video_clip() if yolo_deepsort.shape[0]: inputs, inpboxes, = ava_inference_transform(clip, yolo_deepsort.pred[0][:, 0:4], crop_size=imsize) inp_boxes = torch.cat([torch.zeros(inp_boxes.shape[0], 1), inp_boxes], dim=1) if isinstance(inputs, list): inputs = [inp.unsqueeze(0).to(device) for inp in inputs] else: inputs = inputs.unqueeze(0).to(device) with torch.no_grad(): slowfast_predicts = video_model(inputs, inp_boxes.to(device)) slowfast_predicts = slowfast_predicts.cpu() for tid, ava_label in zip(yolo_deepsort.pred[0][:, 5].tolist(), np.argmax(slowfast_predicts, axis=1).tolist()): id_to_ava_labels[tid] = ava_label_names[ava_label + 1] save_predicts_to_video(yolo_deepsort, id_to_ava_labels, coco_color_map, output_video, config.show) … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午4:39 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31) You can try debugging to view internal data changes. The main reason is that the output results of YOLOv5 and YOLOv8 are not in the same format, and YOLOv8's output does not include the prefix option. If you need it, I can show you the changes. … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午3:02 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31) Hello, I would like to ask if you have such a problem during replacement? for j in range(len(yolo_preds.pred)): AttributeError: 'list' object has no attribute 'pred' How to solve this problem? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> Thank you very much for your reply. I am now trying to modify the input of deepsort_update, but I have not been able to do it. I wonder if you have time to show it to me. 非常感谢您的回复。我现在正在尝试修改deepsort_update的输入,但一直没能做到。我不知道你是否有时间给我展示一下。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>
Friend, thank you very much for your help. Based on the code you showed, I modified my code. The program can run, and the output results can correctly identify the characters in each frame, but the output video has no results. Is this the case with your output video? 朋友,非常感谢你的帮助。根据您显示的代码,我修改了我的代码。程序可以运行,输出结果可以正确识别每一帧中的人物,但输出视频没有结果。您的输出视频是否属于这种情况?
while not cap.end: ret, img = cap.read() if not ret: continue results = model([img]) predicts_xyxy = [] for result in results: yolo_deepsort.ims = result.orig_img yolo_deepsort.names = result.names yolo_deepsort.shape = result.boxes.shape yolo_deepsort.pred = result.boxes.conf for info in result.boxes.data: x1, y1, x2, y2, score, class_id = info # xyxy to xywh x, y, w, h = xyxy2xywh(x1, y1, x2, y2) predicts_xyxy.append([float(x), float(y), float(w), float(h), float(score), int(class_id), int(0)]) predicts_xyxy = np.array(predicts_xyxy) deepsort_outputs = [] # for j in range(len(predicts_xyxy)): if len(predicts_xyxy) == 0: continue xywh = torch.tensor(predicts_xyxy[:, :4]) temp = deepsort_update(deepsort_tracker, torch.tensor(predicts_xyxy), xywh, img) # print(temp) if len(temp) == 0: temp = np.ones((0, 8)) deepsort_outputs.append(temp.astype(np.float32)) yolo_deepsort.pred = deepsort_outputs if len(cap.stack) == 25: print(f"processing {cap.idx // 25}th second clips") clip = cap.get_video_clip() if yolo_deepsort.shape[0]: inputs, inpboxes, = ava_inference_transform(clip, yolo_deepsort.pred[0][:, 0:4], crop_size=imsize) inp_boxes = torch.cat([torch.zeros(inp_boxes.shape[0], 1), inp_boxes], dim=1) if isinstance(inputs, list): inputs = [inp.unsqueeze(0).to(device) for inp in inputs] else: inputs = inputs.unqueeze(0).to(device) with torch.no_grad(): slowfast_predicts = video_model(inputs, inp_boxes.to(device)) slowfast_predicts = slowfast_predicts.cpu() for tid, ava_label in zip(yolo_deepsort.pred[0][:, 5].tolist(), np.argmax(slowfast_predicts, axis=1).tolist()): id_to_ava_labels[tid] = ava_label_names[ava_label + 1] save_predicts_to_video(yolo_deepsort, id_to_ava_labels, coco_color_map, output_video, config.show) … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午4:39 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31) You can try debugging to view internal data changes. The main reason is that the output results of YOLOv5 and YOLOv8 are not in the same format, and YOLOv8's output does not include the prefix option. If you need it, I can show you the changes. … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年5月21日(星期二) 下午3:02 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wufan-tb/yolo_slowfast] 我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢? (Issue #31) Hello, I would like to ask if you have such a problem during replacement? for j in range(len(yolo_preds.pred)): AttributeError: 'list' object has no attribute 'pred' How to solve this problem? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> Thank you very much for your reply. I am now trying to modify the input of deepsort_update, but I have not been able to do it. I wonder if you have time to show it to me. 非常感谢您的回复。我现在正在尝试修改deepsort_update的输入,但一直没能做到。我不知道你是否有时间给我展示一下。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> Friend, this is my email address. I hope to discuss this issue with you. qingzheng939@gmail.com
我用YOLOv8替换了YOLOv5,为什么行为检测就一直是Unknow呢?这有什么影响吗?