Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'It looks like you are subclassing Model and you ' #27

Closed
ray-lee-94 opened this issue Oct 2, 2018 · 2 comments
Closed

'It looks like you are subclassing Model and you ' #27

ray-lee-94 opened this issue Oct 2, 2018 · 2 comments

Comments

@ray-lee-94
Copy link

I would like to retrain the maskrcnn from the released model. But I got errors below:


/home/wen/anaconda3/bin/python /home/wen/net_project/MASK/Mask_RCNN-master/samples/coco/coco.py train --dataset=/home/wen/net_project/MASK/data/ --model=/home/wen/net_project/MASK/Mask_RCNN-master/weight/resnet50_coco_v0.1.0.h5
Using TensorFlow backend.
Command: train
Model: /home/wen/net_project/MASK/Mask_RCNN-master/weight/resnet50_coco_v0.1.0.h5
Dataset: /home/wen/net_project/MASK/data/
Year: 2014
Logs: /home/wen/net_project/MASK/Mask_RCNN-master/logs
Auto Download: False

Configurations:
BACKBONE resnet50
BACKBONE_STRIDES [4, 8, 16, 32, 64]
BATCH_SIZE 8
BBOX_STD_DEV [0.1 0.1 0.2 0.2]
COMPUTE_BACKBONE_SHAPE None
DETECTION_MAX_INSTANCES 100
DETECTION_MIN_CONFIDENCE 0.7
DETECTION_NMS_THRESHOLD 0.3
FPN_CLASSIF_FC_LAYERS_SIZE 1024
GPU_COUNT 4
GRADIENT_CLIP_NORM 5.0
IMAGES_PER_GPU 2
IMAGE_MAX_DIM 1024
IMAGE_META_SIZE 93
IMAGE_MIN_DIM 800
IMAGE_MIN_SCALE 0
IMAGE_RESIZE_MODE square
IMAGE_SHAPE [1024 1024 3]
LEARNING_MOMENTUM 0.9
LEARNING_RATE 0.001
LOSS_WEIGHTS {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0}
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
TOP_DOWN_PYRAMID_SIZE 256
TRAIN_BN False
TRAIN_ROIS_PER_IMAGE 200
USE_MINI_MASK True
USE_RPN_ROIS True
VALIDATION_STEPS 50
WEIGHT_DECAY 0.0001

Traceback (most recent call last):
File "/home/wen/anaconda3/lib/python3.6/site-packages/keras/engine/network.py", line 313, in setattr
is_graph_network = self._is_graph_network
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/parallel_model.py", line 46, in getattribute
return super(ParallelModel, self).getattribute(attrname)
AttributeError: 'ParallelModel' object has no attribute '_is_graph_network'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/wen/net_project/MASK/Mask_RCNN-master/samples/coco/coco.py", line 455, in
model_dir=args.logs)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/model.py", line 1848, in init
self.keras_model = self.build(mode=mode, config=config)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/model.py", line 2073, in build
model = ParallelModel(model, config.GPU_COUNT)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/parallel_model.py", line 35, in init
self.inner_model = keras_model
File "/home/wen/anaconda3/lib/python3.6/site-packages/keras/engine/network.py", line 316, in setattr
'It looks like you are subclassing Model and you '
RuntimeError: It looks like you are subclassing Model and you forgot to call super(YourClass, self).__init__(). Always start with this line.

Process finished with exit code 1

the tensorflow is 1.10. Keras is 2.2.2. when I degrade Keras to 2.1.3, another error occured.

Loading weights /home/wen/net_project/MASK/Mask_RCNN-master/weight/resnet50_coco_v0.1.0.h5
Traceback (most recent call last):
File "/home/wen/net_project/MASK/Mask_RCNN-master/samples/coco/coco.py", line 474, in
model.load_weights(model_path, by_name=True)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/model.py", line 2141, in load_weights
saving.load_weights_from_hdf5_group_by_name(f, layers)
File "/home/wen/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 3233, in load_weights_from_hdf5_group_by_name
' element(s).')
ValueError: Layer #2 (named "conv1") expects 2 weight(s), but the saved weights have 1 element(s).


Maybe that the pretrained model dosen't fit the network?

@ray-lee-94
Copy link
Author

There is no reply. I switch to single GPU that the error disappear.

@hgaiser
Copy link
Contributor

hgaiser commented Oct 8, 2018

Hey, sorry about that. multi-gpu on keras-maskrcnn isn't supported at the moment. It's also not in the train.py actually, how did you enable it?

@hgaiser hgaiser closed this as completed Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants