smallcorgi / Faster-RCNN_TF

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

NoneType error #316

Open FanLu1994 opened 6 years ago

FanLu1994 commented 6 years ago

I'm using tensorflow1.10 on ubuntu18.04. how can i fix this problem

Traceback (most recent call last): File "./tools/demo.py", line 114, in net = get_network(args.demo_net) File "/home/fanlu/Faster-RCNN_TF/tools/../lib/networks/factory.py", line 28, in get_network return networks.VGGnet_test() File "/home/fanlu/Faster-RCNN_TF/tools/../lib/networks/VGGnet_test.py", line 16, in init self.setup() File "/home/fanlu/Faster-RCNN_TF/tools/../lib/networks/VGGnet_test.py", line 57, in setup .fc(4096, name='fc6') File "/home/fanlu/Faster-RCNN_TF/tools/../lib/networks/network.py", line 25, in layer_decorated layer_output = op(self, layer_input, *args, **kwargs) File "/home/fanlu/Faster-RCNN_TF/tools/../lib/networks/network.py", line 246, in fc feed_in, dim = (input, int(input_shape[-1])) TypeError: int returned non-int (type NoneType)

qingping95 commented 5 years ago

Hi, I also encountered the same issue. Do you solve this problem?

FanLu1994 commented 5 years ago

@qingping95 sorry, i didn't solve it. it's probably caused by TF version. I’m using faster-rcnn.pytorch. https://github.com/jwyang/faster-rcnn.pytorch

qingping95 commented 5 years ago

@CodeForWuyu Yeah, You are right! I just now solved it by changing my tensorflow version to 1.8.1. Thank you for your reply.

saizhang12 commented 5 years ago

I was able to make it work for TF 1.10.1 after making the following changes:

add the following lines to lib/roi_pooling_layer/roi_pooling_op.cc

include "tensorflow/core/framework/shape_inference.h"

... .Output("argmax: int32") .SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) { //https://github.com/tensorflow/.../core/framework/shape_inference.h int pooled_height; int pooled_width; c->GetAttr("pooled_height", &pooled_height); c->GetAttr("pooled_width", &pooled_width); auto pooled_height_h = c->MakeDim(pooled_height); auto pooled_width_h = c->MakeDim(pooled_width); auto output_shape = c->MakeShape({ c->Dim(c->input(1), 0), pooled_height_h, pooled_width_h, c->Dim(c->input(0), 3) }); c->set_output(0, output_shape); return Status::OK(); });

You can also find the changes at https://github.com/saizhang12/Faster-RCNN_TF/blob/master/lib/roi_pooling_layer/roi_pooling_op.cc

fanzhoulll commented 5 years ago

Amazing !