But it still reports the following error:
Traceback (most recent call last):
File "J:/myproject/car_wood/yolov7_d2-main/train_custom_datasets.py", line 114, in
args=(args,),
File "g:\detectron2\detectron2\detectron2\engine\launch.py", line 82, in launch
main_func(args)
File "J:/myproject/car_wood/yolov7_d2-main/train_custom_datasets.py", line 101, in main
trainer = Trainer(cfg)
File "g:\detectron2\detectron2\detectron2\engine\defaults.py", line 378, in init
data_loader = self.build_train_loader(cfg)
File "J:\myproject\car_wood\yolov7_d2-main\train_det.py", line 34, in build_train_loader
return build_detection_train_loader(cfg, mapper=cls.custom_mapper)
File "g:\detectron2\detectron2\detectron2\config\config.py", line 207, in wrapped
explicit_args = _get_args_from_config(from_config, args, *kwargs)
File "g:\detectron2\detectron2\detectron2\config\config.py", line 245, in _get_args_from_config
ret = from_config_func(args, **kwargs)
File "g:\detectron2\detectron2\detectron2\data\build.py", line 350, in _train_loader_from_config
proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None,
File "g:\detectron2\detectron2\detectron2\data\build.py", line 241, in get_detection_dataset_dicts
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names]
File "g:\detectron2\detectron2\detectron2\data\build.py", line 241, in
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names]
File "g:\detectron2\detectron2\detectron2\data\catalog.py", line 58, in get
return f()
File "g:\detectron2\detectron2\detectron2\data\datasets\coco.py", line 500, in
DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name))
File "g:\detectron2\detectron2\detectron2\data\datasets\coco.py", line 69, in load_coco_json
coco_api = COCO(json_file)
File "D:\software\anaconda\Anaconda3\envs\yolov7-mask\lib\site-packages\pycocotools\coco.py", line 81, in init
with open(annotation_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'datasets\coco/annotations/instances_train2017.json'
hi! I configure the following parameters in the file train_custom_datasets.py
DATASET_ROOT = "./datasets/single_woodmask/" ANN_ROOT = os.path.join(DATASET_ROOT, "annotations") TRAIN_PATH = os.path.join(DATASET_ROOT, "train2017") VAL_PATH = os.path.join(DATASET_ROOT, "val2017") TRAIN_JSON = os.path.join(ANN_ROOT, "instances_train2017.json") VAL_JSON = os.path.join(ANN_ROOT, "instances_val2017.json") register_coco_instances("single_woodmask_train", {}, TRAIN_JSON, TRAIN_PATH) register_coco_instances("single_woodmask_val", {}, VAL_JSON, VAL_PATH)
But it still reports the following error: Traceback (most recent call last): File "J:/myproject/car_wood/yolov7_d2-main/train_custom_datasets.py", line 114, in
args=(args,),
File "g:\detectron2\detectron2\detectron2\engine\launch.py", line 82, in launch
main_func(args)
File "J:/myproject/car_wood/yolov7_d2-main/train_custom_datasets.py", line 101, in main
trainer = Trainer(cfg)
File "g:\detectron2\detectron2\detectron2\engine\defaults.py", line 378, in init
data_loader = self.build_train_loader(cfg)
File "J:\myproject\car_wood\yolov7_d2-main\train_det.py", line 34, in build_train_loader
return build_detection_train_loader(cfg, mapper=cls.custom_mapper)
File "g:\detectron2\detectron2\detectron2\config\config.py", line 207, in wrapped
explicit_args = _get_args_from_config(from_config, args, *kwargs)
File "g:\detectron2\detectron2\detectron2\config\config.py", line 245, in _get_args_from_config
ret = from_config_func(args, **kwargs)
File "g:\detectron2\detectron2\detectron2\data\build.py", line 350, in _train_loader_from_config
proposal_files=cfg.DATASETS.PROPOSAL_FILES_TRAIN if cfg.MODEL.LOAD_PROPOSALS else None,
File "g:\detectron2\detectron2\detectron2\data\build.py", line 241, in get_detection_dataset_dicts
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names]
File "g:\detectron2\detectron2\detectron2\data\build.py", line 241, in
dataset_dicts = [DatasetCatalog.get(dataset_name) for dataset_name in names]
File "g:\detectron2\detectron2\detectron2\data\catalog.py", line 58, in get
return f()
File "g:\detectron2\detectron2\detectron2\data\datasets\coco.py", line 500, in
DatasetCatalog.register(name, lambda: load_coco_json(json_file, image_root, name))
File "g:\detectron2\detectron2\detectron2\data\datasets\coco.py", line 69, in load_coco_json
coco_api = COCO(json_file)
File "D:\software\anaconda\Anaconda3\envs\yolov7-mask\lib\site-packages\pycocotools\coco.py", line 81, in init
with open(annotation_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'datasets\coco/annotations/instances_train2017.json'
Process finished with exit code 1
How can I fix this error?Thank you!