Superlee506 / Mask_RCNN_Humanpose

Mask R-CNN for Human Pose Estimation on Keras and TensorFlow.
Other
189 stars 36 forks source link

AttributeError: 'ShapesConfig' object has no attribute 'KEYPOINT_MASK_SHAPE' #9

Closed wuhuhu800 closed 6 years ago

wuhuhu800 commented 6 years ago

hey: I'm runing train_shape.ipynb ,when run the line

# Create model in training mode
model = modellib.MaskRCNN(mode="training", config=config,
                          model_dir=MODEL_DIR)

I get some errors like that:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-ae82d0e47c39> in <module>()
      1 # Create model in training mode
      2 model = modellib.MaskRCNN(mode="training", config=config,
----> 3                           model_dir=MODEL_DIR)

~/keyPoints/Mask_rcnn/Mask_RCNN_Humanpose/model.py in __init__(self, mode, config, model_dir)
   2514         self.model_dir = model_dir
   2515         self.set_log_dir()
-> 2516         self.keras_model = self.build(mode=mode, config=config)
   2517 
   2518     def build(self, mode, config):

~/keyPoints/Mask_rcnn/Mask_RCNN_Humanpose/model.py in build(self, mode, config)
   2679             rois, target_class_ids, target_bbox, target_keypoint, target_keypoint_weight, target_mask = \
   2680                 DetectionKeypointTargetLayer(config, name="proposal_targets")\
-> 2681                     ([target_rois, input_gt_class_ids, gt_boxes, gt_keypoints, input_gt_masks])
   2682 
   2683             # Network Heads

~/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py in __call__(self, inputs, **kwargs)
    617 
    618             # Actually call the layer, collecting output(s), mask(s), and shape(s).
--> 619             output = self.call(inputs, **kwargs)
    620             output_mask = self.compute_mask(inputs, previous_mask)
    621 

~/keyPoints/Mask_rcnn/Mask_RCNN_Humanpose/model.py in call(self, inputs)
    838             lambda r, x, y, z, m: detection_keypoint_targets_graph(
    839                 r, x, y, z, m,self.config),
--> 840             self.config.IMAGES_PER_GPU, names=names)
    841         return outputs
    842 

~/keyPoints/Mask_rcnn/Mask_RCNN_Humanpose/utils.py in batch_slice(inputs, graph_fn, batch_size, names)
    992     for i in range(batch_size):
    993         inputs_slice = [x[i] for x in inputs]
--> 994         output_slice = graph_fn(*inputs_slice)
    995         if not isinstance(output_slice, (tuple, list)):
    996             output_slice = [output_slice]

~/keyPoints/Mask_rcnn/Mask_RCNN_Humanpose/model.py in <lambda>(r, x, y, z, m)
    837             [proposals, gt_class_ids, gt_boxes, gt_keypoints, gt_masks],
    838             lambda r, x, y, z, m: detection_keypoint_targets_graph(
--> 839                 r, x, y, z, m,self.config),
    840             self.config.IMAGES_PER_GPU, names=names)
    841         return outputs

~/keyPoints/Mask_rcnn/Mask_RCNN_Humanpose/model.py in detection_keypoint_targets_graph(proposals, gt_class_ids, gt_boxes, gt_keypoints, gt_masks, config)
    726     y2 = y2[:, 0]
    727     x2 = x2[:, 0]
--> 728     scale_x = tf.cast(config.KEYPOINT_MASK_SHAPE[1] / ((x2 - x1) * config.IMAGE_SHAPE[1]), tf.float32)
    729     scale_y = tf.cast(config.KEYPOINT_MASK_SHAPE[0] / ((y2 - y1) * config.IMAGE_SHAPE[0]), tf.float32)
    730     keypoint_lables = []

AttributeError: 'ShapesConfig' object has no attribute 'KEYPOINT_MASK_SHAPE'

how can I fix it ,thank you

Superlee506 commented 6 years ago

@wuhuhu800 train_shape.ipynb is used for training another task, not for the human pose estimation.

wuhuhu800 commented 6 years ago

@Superlee506 Got it,thank you very much.

wuhuhu800 commented 6 years ago

@Superlee506 Hey: In model.py ,the function called detection_keypoint_targets_graph that in the 728th line

scale_x = tf.cast(config.KEYPOINT_MASK_SHAPE[1] / ((x2 - x1) * config.IMAGE_SHAPE[1]), tf.float32)

the vaiable KEYPOINT_MASK_SHAPE seems not appear in config.py,how do you deal with it ?

thank you

Superlee506 commented 6 years ago

@wuhuhu800 This function is in CocoConfig class.