smallcorgi / Faster-RCNN_TF

Faster-RCNN in Tensorflow
MIT License
2.34k stars 1.12k forks source link

RoI Pooling return <unknown> Tensor #278

Open UpCoder opened 6 years ago

UpCoder commented 6 years ago

Hi, I run the demo without any problems. However, I write some code to achieve some goals that happen errors. When I call the roi_pool function, there is a error: roi_pool = roi_pooling_op.roi_pool(conv5_3, rois, 7, 7, 1.0/16, name='roi_pool')[0]

the shape of conv5_3 and rois is (?, ?, ?, 512) (?, 5) respectively. and the shape of roi_pool is unknown which lead I can not do any operations next. such as fully connected layers.

I find the output of roi_pool is (?, 7, 7, 512) in demo with same code. However, the output of my code is . So sad!

guozhiyao commented 5 years ago

sorry to interrupt you ,I meet the same problem with you. Have you solve the problem? Thank you.

UpCoder commented 5 years ago

@guozhiyao Maybe we must set the shape of input_image, then the size of the feature map will not be unknown.

guozhiyao commented 5 years ago

I have tried this approach, but it doesn't work... code:

input_feature = tf.placeholder(shape=[None,128,128,1],dtype=tf.float32)
rois = tf.placeholder(shape=[None,5],dtype=tf.float32)
print input_feature
print rois
result = roi_pool_op.roi_pool(input_feature,rois,2,2,1.0/16,name='try')
print result
  1. without image size Tensor("Placeholder:0", shape=(?, ?, ?, 1), dtype=float32) Tensor("Placeholder_1:0", shape=(?, 5), dtype=float32) RoiPool(top_data=<tf.Tensor 'try:0' shape= dtype=float32>, argmax=<tf.Tensor 'try:1' shape= dtype=int32>)

2.with image size Tensor("Placeholder:0", shape=(?, 128, 128, 1), dtype=float32) Tensor("Placeholder_1:0", shape=(?, 5), dtype=float32) RoiPool(top_data=<tf.Tensor 'try:0' shape= dtype=float32>, argmax=<tf.Tensor 'try:1' shape= dtype=int32>)

guozhiyao commented 5 years ago

Excuse me, how do you solve this problem finally?

guozhiyao commented 5 years ago

I use the other code of roi pooling op : roi pooling It works. But we should add the spatial rate and change the order of dimension by ourselves.