Mask_rcnn: No 'instances_train2014.json' File Found Error Issue

Created on 9 Feb 2018  路  4Comments  路  Source: matterport/Mask_RCNN

Hi,

I am trying to train for coco2014 dataset. (I just followed this repo's training example)

I put coco dataset on
home/mson/download/Mask_RCNN/coco/train2014/(image files..)
home/mson/download/Mask_RCNN/coco/val2014/(image files..)
home/mson/download/Mask_RCNN/coco/annotations/(.json files including 'instances_train2014.json')

The command I am using is: python coco.py train --dataset=/path/to/coco/ --model=coco

The result I can see is that
FileNotFoundError: [Errno 2] No such file or directory: '/path/to/coco/annotations /instances_train2014.json'

Can anyone please help? Please see the logs below.

/home/mson/anaconda3/envs/tf/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Command: train
Model: coco
Dataset: /path/to/coco/
Year: 2014
Logs: /home/mson/download/Mask_RCNN/logs
Auto Download: False

Configurations:
BACKBONE_SHAPES [[256 256]
[128 128]
[ 64 64]
[ 32 32]
[ 16 16]]
BACKBONE_STRIDES [4, 8, 16, 32, 64]
BATCH_SIZE 2
BBOX_STD_DEV [0.1 0.1 0.2 0.2]
DETECTION_MAX_INSTANCES 100
DETECTION_MIN_CONFIDENCE 0.7
DETECTION_NMS_THRESHOLD 0.3
GPU_COUNT 1
IMAGES_PER_GPU 2
IMAGE_MAX_DIM 1024
IMAGE_MIN_DIM 800
IMAGE_PADDING True
IMAGE_SHAPE [1024 1024 3]
LEARNING_MOMENTUM 0.9
LEARNING_RATE 0.001
MASK_POOL_SIZE 14
MASK_SHAPE [28, 28]
MAX_GT_INSTANCES 100
MEAN_PIXEL [123.7 116.8 103.9]
MINI_MASK_SHAPE (56, 56)
NAME coco
NUM_CLASSES 81
POOL_SIZE 7
POST_NMS_ROIS_INFERENCE 1000
POST_NMS_ROIS_TRAINING 2000
ROI_POSITIVE_RATIO 0.33
RPN_ANCHOR_RATIOS [0.5, 1, 2]
RPN_ANCHOR_SCALES (32, 64, 128, 256, 512)
RPN_ANCHOR_STRIDE 1
RPN_BBOX_STD_DEV [0.1 0.1 0.2 0.2]
RPN_NMS_THRESHOLD 0.7
RPN_TRAIN_ANCHORS_PER_IMAGE 256
STEPS_PER_EPOCH 1000
TRAIN_ROIS_PER_IMAGE 200
USE_MINI_MASK True
USE_RPN_ROIS True
VALIDATION_STEPS 50
WEIGHT_DECAY 0.0001

Loading weights /home/mson/download/Mask_RCNN/mask_rcnn_coco.h5
2018-02-09 16:07:30.877009: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-02-09 16:07:31.080556: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:895] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-02-09 16:07:31.080894: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1105] Found device 0 with properties:
name: Quadro K5200 major: 3 minor: 5 memoryClockRate(GHz): 0.771
pciBusID: 0000:02:00.0
totalMemory: 7.93GiB freeMemory: 7.51GiB
2018-02-09 16:07:31.080922: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1195] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: Quadro K5200, pci bus id: 0000:02:00.0, compute capability: 3.5)
loading annotations into memory...
Traceback (most recent call last):
File "coco.py", line 476, in
dataset_train.load_coco(args.dataset, "train", year=args.year, auto_download=args.download)
File "coco.py", line 108, in load_coco
coco = COCO("{}annotations/instances_{}{}.json".format(dataset_dir, subset, year))
File "/home/mson/anaconda3/envs/tf/lib/python3.6/site-packages/pycocotools/coco.py", line 79, in __init__
dataset = json.load(open(annotation_file, 'r'))
FileNotFoundError: [Errno 2] No such file or directory: '/path/to/coco/annotations/instances_train2014.json'

Most helpful comment

You need to pass the path to coco as the --dataset argument,
/path/to/coco/ has to become /home/mson/download/Mask_RCNN/coco, which gives you

python coco.py train --dataset=/home/mson/download/Mask_RCNN/coco --model=coco

You do not think coco will magically find your dataset, right?

All 4 comments

I tried to solve this prob for two days please help me thanks!

You need to pass the path to coco as the --dataset argument,
/path/to/coco/ has to become /home/mson/download/Mask_RCNN/coco, which gives you

python coco.py train --dataset=/home/mson/download/Mask_RCNN/coco --model=coco

You do not think coco will magically find your dataset, right?

@msson ,
As @monomon said, that is the right way to pass coco data set, if it still failed. You need to remove the json file manually and let the script download again.

Another potential issue if you give --dataset=~/<path>, it won't work as it is unable to expand '~' to /home/user/.

Was this page helpful?
0 / 5 - 0 ratings