Egrt / yolov7-obb

在YOLOv7的基础上使用KLD损失修改为旋转目标检测yolov7-obb
GNU General Public License v3.0
181 stars 26 forks source link

每次运行到第10个epoch都会报错,请问大家如何解决 #8

Open wei3044 opened 1 year ago

wei3044 commented 1 year ago
Traceback (most recent call last):
      File "/content/drive/MyDrive/yolov7-obb-Bubbliiiing/train.py", line 556, in <module>
        fit_one_epoch(model_train, model, ema, yolo_loss, loss_history, eval_callback, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, UnFreeze_Epoch, Cuda, fp16, scaler, save_period, save_dir, local_rank)
      File "/content/drive/MyDrive/yolov7-obb-Bubbliiiing/utils/utils_fit.py", line 104, in fit_one_epoch
        eval_callback.on_epoch_end(epoch + 1, model_train_eval)
      File "/content/drive/MyDrive/yolov7-obb-Bubbliiiing/utils/callbacks.py", line 206, in on_epoch_end
        self.get_map_txt(image_id, image, self.class_names, self.map_out_path)
      File "/content/drive/MyDrive/yolov7-obb-Bubbliiiing/utils/callbacks.py", line 142, in get_map_txt
        results = self.bbox_util.non_max_suppression(torch.cat(outputs, 1), self.num_classes, self.input_shape, 
      File "/content/drive/MyDrive/yolov7-obb-Bubbliiiing/utils/utils_bbox.py", line 174, in non_max_suppression
        _, keep = obb_nms(
      File "/content/drive/MyDrive/yolov7-obb-Bubbliiiing/utils/nms_rotated/nms_rotated_wrapper.py", line 37, in obb_nms
        ori_inds = ori_inds[~too_small]
    RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
Gggggm78 commented 1 year ago

请问各位大佬这个问题如何解决,望不吝赐教 我的是报如下错误:

Traceback (most recent call last): File "d:\yolov7-obb\utils\callbacks.py", line 223, in on_epoch_end temp_map = get_coco_map(class_names = self.class_names, path = self.map_out_path)[1] File "d:\yolov7-obb\utils\utils_map.py", line 934, in get_coco_map cocoGt = COCO(GT_JSON_PATH) NameError: name 'COCO' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:/yolov7-obb/train.py", line 552, in fit_one_epoch(model_train, model, ema, yolo_loss, loss_history, eval_callback, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, UnFreeze_Epoch, Cuda, fp16, scaler, save_period, save_dir, local_rank) File "d:\yolov7-obb\utils\utils_fit.py", line 104, in fit_one_epoch eval_callback.on_epoch_end(epoch + 1, model_train_eval) File "d:\yolov7-obb\utils\callbacks.py", line 225, in on_epoch_end temp_map = get_map(self.MINOVERLAP, False, path = self.map_out_path) File "d:\yolov7-obb\utils\utils_map.py", line 438, in get_map bounding_boxes.sort(key=lambda x:float(x['confidence']), reverse=True) File "d:\yolov7-obb\utils\utils_map.py", line 438, in bounding_boxes.sort(key=lambda x:float(x['confidence']), reverse=True) ValueError: could not convert string to float: 'ship'

Gggggm78 commented 1 year ago

请问各位大佬这个问题如何解决,望不吝赐教 我的是报如下错误:

Traceback (most recent call last): File "d:\yolov7-obb\utils\callbacks.py", line 223, in on_epoch_end temp_map = get_coco_map(class_names = self.class_names, path = self.map_out_path)[1] File "d:\yolov7-obb\utils\utils_map.py", line 934, in get_coco_map cocoGt = COCO(GT_JSON_PATH) NameError: name 'COCO' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "d:/yolov7-obb/train.py", line 552, in fit_one_epoch(model_train, model, ema, yolo_loss, loss_history, eval_callback, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, UnFreeze_Epoch, Cuda, fp16, scaler, save_period, save_dir, local_rank) File "d:\yolov7-obb\utils\utils_fit.py", line 104, in fit_one_epoch eval_callback.on_epoch_end(epoch + 1, model_train_eval) File "d:\yolov7-obb\utils\callbacks.py", line 225, in on_epoch_end temp_map = get_map(self.MINOVERLAP, False, path = self.map_out_path) File "d:\yolov7-obb\utils\utils_map.py", line 438, in get_map bounding_boxes.sort(key=lambda x:float(x['confidence']), reverse=True) File "d:\yolov7-obb\utils\utils_map.py", line 438, in bounding_boxes.sort(key=lambda x:float(x['confidence']), reverse=True) ValueError: could not convert string to float: 'ship'

因为eval_period = 10,所以在训练到10epoch的时候会进行评估,报错是因为评估过程出错了,我在debug的过程中发现是confidence获取的值不对,经过不断的尝试发现“.temp_map_out”文件夹下子文件夹里有之前跑的一些结果文件,导致了读取错误,因此我把“.temp_map_out”文件夹目录下的所有文件都删除,重新运行train.py后不报错,供大家参考。

shikeart commented 1 year ago

兄弟,能加个好友不,我最近也在配这个项目,遇到和问题差不多,平时互相交流交流

ZHOU-ZHOU-YI commented 1 year ago

我也遇到这个问题了,删掉后还是会报这个错

777Zhao commented 1 year ago

NameError: name 'COCO' is not defined,处理一下这个就可以了

---原始邮件--- 发件人: @.> 发送时间: 2023年5月4日(周四) 中午1:25 收件人: @.>; 抄送: @.**@.>; 主题: Re: [Egrt/yolov7-obb] 每次运行到第10个epoch都会报错,请问大家如何解决 (Issue #8)

我也遇到这个问题了,删掉后还是会报这个错

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

wei3044 commented 1 year ago

请问有无大佬知道怎么解决呀

chishiwen commented 1 year ago

pip install pycocotools

Schweizliu commented 1 year ago

pip install pycocotools

确实是这个的原因

hecheng000 commented 1 year ago

兄弟,能加个好友不,我最近也在配这个项目,遇到和问题差不多,平时互相交流交流

可以加一下好友吗 交流下

Schweizliu commented 1 year ago

可以的

------------------ 原始邮件 ------------------ 发件人: "Egrt/yolov7-obb" @.>; 发送时间: 2023年7月12日(星期三) 中午1:41 @.>; @.**@.>; 主题: Re: [Egrt/yolov7-obb] 每次运行到第10个epoch都会报错,请问大家如何解决 (Issue #8)

兄弟,能加个好友不,我最近也在配这个项目,遇到和问题差不多,平时互相交流交流

可以加一下好友吗 交流下

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>