z1069614715 / objectdetection_script

一些关于目标检测的脚本的改进思路代码,详细请看readme.md
5.3k stars 476 forks source link

errno13 permission denied #20

Closed tianbo321 closed 1 year ago

tianbo321 commented 1 year ago

导师你好,yolov5-7.0测试时老报错,麻烦您看一下。 `Speed: 1.1ms pre-process, 16.7ms inference, 4.0ms NMS per image at shape (1, 3, 640, 640)

Evaluating pycocotools mAP... saving runs\val\exp17\best_predictions.json... pycocotools unable to run: [Errno 13] Permission denied: 'C:\Users\admin\Desktop\yolov5-7.0' Results saved to runs\val\exp17 loading annotations into memory...

Process finished with exit code 0`

tianbo321 commented 1 year ago

修改了anno_json的路径,使用命令行运行,开启了--save-json ` if save_json and len(jdict): w = Path(weights[0] if isinstance(weights, list) else weights).stem if weights is not None else '' # weights anno_json = str(Path(data.get('path', 'val.json'))) # annotations json pred_json = str(save_dir / f"{w}_predictions.json") # predictions json LOGGER.info(f'\nEvaluating pycocotools mAP... saving {pred_json}...') with open(pred_json, 'w') as f: json.dump(jdict, f)

    try:  # https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
        check_requirements('pycocotools')
        from pycocotools.coco import COCO
        from pycocotools.cocoeval import COCOeval

        anno = COCO(anno_json)  # init annotations api
        pred = anno.loadRes(pred_json)  # init predictions api
        eval = COCOeval(anno, pred, 'bbox')
        if is_coco:
            eval.params.imgIds = [int(Path(x).stem) for x in dataloader.dataset.im_files]  # image IDs to evaluate
        eval.evaluate()
        eval.accumulate()
        eval.summarize()
        map, map50 = eval.stats[:2]  # update results (mAP@0.5:0.95, mAP@0.5)
    except Exception as e:
        LOGGER.info(f'pycocotools unable to run: {e}')`
tianbo321 commented 1 year ago

已经解决,是把path换成具体路径,但是发现ap值很低,比正常yolo算出来的低

z1069614715 commented 1 year ago

这种情况一般是转换不对,这个转换比较苛刻,要求比较多,id啥的对不上,精度就会对不上了

tianbo321 commented 1 year ago

那就是导师的yolo2coco代码可能有问题?id有可能没对上?

z1069614715 commented 1 year ago

我这边测试是没问题的,但是每个人的数据集的命名差异我不能保证到全部哈

z1069614715 commented 1 year ago

实验发现,命名全为数字出错的几率比较低

tianbo321 commented 1 year ago

懂了导师,谢谢您,正确情况是yolo和coco算出来的结果应该是一样的,对吧。

tianbo321 commented 1 year ago

我是这样命名的 P00071466___1113.txt