Giter Site home page Giter Site logo

Comments (1)

fm64hylian avatar fm64hylian commented on September 7, 2024 1

after following the reply I replaced in model.py by:

#line 338
tf.log() -> tf.math.log()
#lines 716 and 754
tf.sets.set_intersection() -> tf.sets.intersection() 
#lines 718 and 756
tf.sparse_tensor_to_dense() -> tf.sparse.to_dense()
#line 768
tf.to_float() -> tf.cast([tf.gather(class_ids, keep)], tf.float32)[..., tf.newaxis]

and a new error appeared on the same section:

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs, op_def)
   1653   try:
-> 1654     c_op = pywrap_tf_session.TF_FinishOperation(op_desc)
   1655   except errors.InvalidArgumentError as e:

InvalidArgumentError: Shape must be rank 2 but is rank 3 for '{{node mrcnn_detection/concat_1}} = ConcatV2[N=3, T=DT_FLOAT, Tidx=DT_INT32](mrcnn_detection/GatherV2_6, mrcnn_detection/strided_slice_28, mrcnn_detection/strided_slice_29, mrcnn_detection/concat_1/axis)' with input shapes: [?,4], [1,?,1], [?,1], [].

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
16 frames
<ipython-input-10-cbc8b676b8a3> in <module>()
      1 # COCO dataset object names
      2 model = modellib.MaskRCNN(
----> 3     mode="inference", model_dir=MODEL_DIR, config=config
      4 )
      5 model.load_weights(COCO_MODEL_PATH, by_name=True)

/content/drive/My Drive/Mask-RCNN-Shiny-master/mrcnn/model.py in __init__(self, mode, config, model_dir)
   1821         self.model_dir = model_dir
   1822         self.set_log_dir()
-> 1823         self.keras_model = self.build(mode=mode, config=config)
   1824 
   1825     def build(self, mode, config):

/content/drive/My Drive/Mask-RCNN-Shiny-master/mrcnn/model.py in build(self, mode, config)
   2022             # normalized coordinates
   2023             detections = DetectionLayer(config, name="mrcnn_detection")(
-> 2024                 [rpn_rois, mrcnn_class, mrcnn_bbox, input_image_meta])
   2025 
   2026             # Create masks for detections

/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in symbolic_fn_wrapper(*args, **kwargs)
     73         if _SYMBOLIC_SCOPE.value:
     74             with get_graph().as_default():
---> 75                 return func(*args, **kwargs)
     76         else:
     77             return func(*args, **kwargs)

/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py in __call__(self, inputs, **kwargs)
    487             # Actually call the layer,
    488             # collecting output(s), mask(s), and shape(s).
--> 489             output = self.call(inputs, **kwargs)
    490             output_mask = self.compute_mask(inputs, previous_mask)
    491 

/content/drive/My Drive/Mask-RCNN-Shiny-master/mrcnn/model.py in call(self, inputs)
    807             [rois, mrcnn_class, mrcnn_bbox, window],
    808             lambda x, y, w, z: refine_detections_graph(x, y, w, z, self.config),
--> 809             self.config.IMAGES_PER_GPU)
    810 
    811         # Reshape output

/content/drive/My Drive/Mask-RCNN-Shiny-master/mrcnn/utils.py in batch_slice(inputs, graph_fn, batch_size, names)
    823     for i in range(batch_size):
    824         inputs_slice = [x[i] for x in inputs]
--> 825         output_slice = graph_fn(*inputs_slice)
    826         if not isinstance(output_slice, (tuple, list)):
    827             output_slice = [output_slice]

/content/drive/My Drive/Mask-RCNN-Shiny-master/mrcnn/model.py in <lambda>(x, y, w, z)
    806         detections_batch = utils.batch_slice(
    807             [rois, mrcnn_class, mrcnn_bbox, window],
--> 808             lambda x, y, w, z: refine_detections_graph(x, y, w, z, self.config),
    809             self.config.IMAGES_PER_GPU)
    810 

/content/drive/My Drive/Mask-RCNN-Shiny-master/mrcnn/model.py in refine_detections_graph(rois, probs, deltas, window, config)
    768         tf.cast([tf.gather(class_ids, keep)], tf.float32)[..., tf.newaxis],
    769         tf.gather(class_scores, keep)[..., tf.newaxis]
--> 770         ], axis=1)
    771 
    772     # Pad with zeros if detections < DETECTION_MAX_INSTANCES

/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
    178     """Call target, and fall back on dispatchers if there is a TypeError."""
    179     try:
--> 180       return target(*args, **kwargs)
    181     except (TypeError, ValueError):
    182       # Note: convert_to_eager_tensor currently raises a ValueError, not a

/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/array_ops.py in concat(values, axis, name)
   1604           dtype=dtypes.int32).get_shape().assert_has_rank(0)
   1605       return identity(values[0], name=name)
-> 1606   return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
   1607 
   1608 

/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_array_ops.py in concat_v2(values, axis, name)
   1187   _attr_N = len(values)
   1188   _, _, _op, _outputs = _op_def_library._apply_op_helper(
-> 1189         "ConcatV2", values=values, axis=axis, name=name)
   1190   _result = _outputs[:]
   1191   if _execute.must_record_gradient():

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(op_type_name, name, **keywords)
    742       op = g._create_op_internal(op_type_name, inputs, dtypes=None,
    743                                  name=scope, input_types=input_types,
--> 744                                  attrs=attr_protos, op_def=op_def)
    745 
    746     # `outputs` is returned as a separate return value so that the output

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device)
    593     return super(FuncGraph, self)._create_op_internal(  # pylint: disable=protected-access
    594         op_type, inputs, dtypes, input_types, name, attrs, op_def,
--> 595         compute_device)
    596 
    597   def capture(self, tensor, name=None, shape=None):

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device)
   3325           input_types=input_types,
   3326           original_op=self._default_original_op,
-> 3327           op_def=op_def)
   3328       self._create_op_helper(ret, compute_device=compute_device)
   3329     return ret

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
   1815         op_def = self._graph._get_op_def(node_def.op)
   1816       self._c_op = _create_c_op(self._graph, node_def, inputs,
-> 1817                                 control_input_ops, op_def)
   1818       name = compat.as_str(node_def.name)
   1819     # pylint: enable=protected-access

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs, op_def)
   1655   except errors.InvalidArgumentError as e:
   1656     # Convert to ValueError for backwards compatibility.
-> 1657     raise ValueError(str(e))
   1658 
   1659   return c_op

ValueError: Shape must be rank 2 but is rank 3 for '{{node mrcnn_detection/concat_1}} = ConcatV2[N=3, T=DT_FLOAT, Tidx=DT_INT32](mrcnn_detection/GatherV2_6, mrcnn_detection/strided_slice_28, mrcnn_detection/strided_slice_29, mrcnn_detection/concat_1/axis)' with input shapes: [?,4], [1,?,1], [?,1], [].

I understand it has something to do with the dimensions but both test images had the same size, different channels. any ideas? should I close this issue and open a new one with this information?

from mask-rcnn-shiny.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.