CharlesShang / FastMaskRCNN

Mask RCNN in TensorFlow
Apache License 2.0
3.1k stars 1.1k forks source link

ROIAlign wrong?? #45

Open 1145520074 opened 7 years ago

1145520074 commented 7 years ago

when I run data_test.py, it went wrong as follows:

Traceback (most recent call last): File "unit_test/data_test.py", line 48, in feat = ROIAlign(image, boxes, False, 16, 7, 7) File "unit_test/../libs/layers/crop.py", line 42, in crop with tf.control_dependencies([assert_op, images, batch_inds]): File "/home/tuku/.jumbo/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3595, in control_dependencies return get_default_graph().control_dependencies(control_inputs) File "/home/tuku/.jumbo/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3324, in control_dependencies c = self.as_graph_element(c) File "/home/tuku/.jumbo/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2414, in as_graph_element return self._as_graph_element_locked(obj, allow_tensor, allow_operation) File "/home/tuku/.jumbo/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2503, in _as_graph_element_locked % (type(obj).name, types_str)) TypeError: Can not convert a bool into a Tensor or Operation.

Can anyone tell me why?thanks

stevefoy commented 7 years ago

I have a similar issue, any ideas? It's not reading the images correctly.

i'm tracking it to down slowly...

tjussh commented 7 years ago

@1145520074 @stevefoy Hello! I have the same error. Did you solve it?

stevefoy commented 7 years ago

hey tjussh,

I just fixed it this way,

boxes = tf.constant(boxes, tf.float32) batch_inds = np.zeros((4,), dtype=np.int32) batch_inds = tf.convert_to_tensor(batch_inds) feat = ROIAlign(image, boxes, batch_inds , 16, 7, 7)

but the this is not a testing the trained network, I'm finding it slow to write the code to actually test the trained network

jasonwei20 commented 7 years ago

I got this error because I incorrectly uncommented parts from the second crop method, instead of the first crop method.

mathpopo commented 5 years ago

Enabled the below code & it runs fine L.No 34 to 38 of /FastMaskRCNN/libs/layers/crop.py

if batch_inds is False: num_boxes = tf.shape(boxes)[0] batch_inds = tf.zeros([num_boxes], dtype=tf.int32, name='batch_inds') batch_inds = boxes[:, 0] * 0 batch_inds = tf.cast(batch_inds, tf.int32)