Open CachCheng opened 5 years ago
Make sure that you are running the code from the ObjectDetection
folder, and that datasets
is visible from this folder.
Traceback (most recent call last):
File "train_net.py", line 174, in
I build the datasets folder in maskrcnn-benchmark, but i got this error, help!
Traceback (most recent call last): File "train_net.py", line 174, in main() File "train_net.py", line 167, in main model = train(cfg, args.local_rank, args.distributed) File "train_net.py", line 60, in train start_iter=arguments["iteration"], File "/home/opex/maskrcnn-benchmark/maskrcnn_benchmark/data/build.py", line 154, in make_data_loader datasets = build_dataset(dataset_list, transforms, DatasetCatalog, is_train) File "/home/opex/maskrcnn-benchmark/maskrcnn_benchmark/data/build.py", line 44, in build_dataset dataset = factory(args) File "/home/opex/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/coco.py", line 43, in init super(COCODataset, self).init(root, ann_file) File "/home/opex/anaconda3/envs/maskrcnn/lib/python3.7/site-packages/torchvision-0.2.1-py3.7.egg/torchvision/datasets/coco.py", line 97, in init File "/home/opex/anaconda3/envs/maskrcnn/lib/python3.7/site-packages/pycocotools-2.0-py3.7-linux-x86_64.egg/pycocotools/coco.py", line 84, in init** dataset = json.load(open(annotation_file, 'r')) FileNotFoundError: [Errno 2] No such file or directory: 'datasets/coco/annotations/instances_train2014.json'
I build the datasets folder in maskrcnn-benchmark, but i got this error, help!
I put .json in here, like"~/maskrcnn-benchmarch/datasets/coco/annotations/instances_train2014.json"
I meet the same problem when I use pycharm to run the test_net.py. when I in a console in the first maskrcnn-benchmark fold, use commod: python tools/test_net.py .Then it works. I think when I run test_net.py in pycharm. the datasets folder can't been seen.
The issue seems to be that pycocotools is attempting to fetch the annotations from within the site packages folder rather than in the data folder(perhaps switching to an older version of the COCO API would help). I found a temporary fix by adjusting the DATA_DIR variable accordingly in path_catalog.py inside maskrcnn_benchmark/config.
this problem is fixed by cd into tools dir, and then use : python train_net.py ...
Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1741, in main() File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1735, in main globals = debugger.run(setup['file'], None, None, is_module) File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1135, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/chenghong/PycharmProjects/ObjectDetection/tools/train_net.py", line 171, in main() File "/Users/chenghong/PycharmProjects/ObjectDetection/tools/train_net.py", line 164, in main model = train(cfg, args.local_rank, args.distributed) File "/Users/chenghong/PycharmProjects/ObjectDetection/tools/train_net.py", line 60, in train start_iter=arguments["iteration"], File "/Users/chenghong/PycharmProjects/ObjectDetection/maskrcnn_benchmark/data/build.py", line 154, in make_data_loader datasets = build_dataset(dataset_list, transforms, DatasetCatalog, is_train) File "/Users/chenghong/PycharmProjects/ObjectDetection/maskrcnn_benchmark/data/build.py", line 44, in build_dataset dataset = factory(args) File "/Users/chenghong/PycharmProjects/ObjectDetection/maskrcnn_benchmark/data/datasets/coco.py", line 13, in init super(COCODataset, self).init(root, ann_file) File "/Users/chenghong/anaconda3/lib/python3.7/site-packages/torchvision/datasets/coco.py", line 97, in init self.coco = COCO(annFile) File "/Users/chenghong/anaconda3/lib/python3.7/site-packages/pycocotools-2.0-py3.7-macosx-10.7-x86_64.egg/pycocotools/coco.py", line 84, in init** dataset = json.load(open(annotation_file, 'r')) FileNotFoundError: [Errno 2] No such file or directory: 'datasets/coco/annotations/instances_train2014.json'
Have you solved it? Can you tell me how to solve it?
Have you solved it? Can you tell me how to solve it?
In config/paths_catalog.py , set the variable DATA_DIR changed from 'datasets' to '../datasets'
Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1741, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/chenghong/PycharmProjects/ObjectDetection/tools/train_net.py", line 171, in
main()
File "/Users/chenghong/PycharmProjects/ObjectDetection/tools/train_net.py", line 164, in main
model = train(cfg, args.local_rank, args.distributed)
File "/Users/chenghong/PycharmProjects/ObjectDetection/tools/train_net.py", line 60, in train
start_iter=arguments["iteration"],
File "/Users/chenghong/PycharmProjects/ObjectDetection/maskrcnn_benchmark/data/build.py", line 154, in make_data_loader
datasets = build_dataset(dataset_list, transforms, DatasetCatalog, is_train)
File "/Users/chenghong/PycharmProjects/ObjectDetection/maskrcnn_benchmark/data/build.py", line 44, in build_dataset
dataset = factory(**args)
File "/Users/chenghong/PycharmProjects/ObjectDetection/maskrcnn_benchmark/data/datasets/coco.py", line 13, in init
super(COCODataset, self).init(root, ann_file)
File "/Users/chenghong/anaconda3/lib/python3.7/site-packages/torchvision/datasets/coco.py", line 97, in init
self.coco = COCO(annFile)
File "/Users/chenghong/anaconda3/lib/python3.7/site-packages/pycocotools-2.0-py3.7-macosx-10.7-x86_64.egg/pycocotools/coco.py", line 84, in init
dataset = json.load(open(annotation_file, 'r'))
FileNotFoundError: [Errno 2] No such file or directory: 'datasets/coco/annotations/instances_train2014.json'