xmyqsh / FPN

Feature Pyramid Network
155 stars 58 forks source link

How to run test_net? (to get the mAP of my task) #3

Open BestSongEver opened 7 years ago

BestSongEver commented 7 years ago

Hi Thx for your excellent job! I'm a new learner and it benefits me a lot. I notice that there is no test_net.py in FPN/faster_rcnn/

So, could u tell me how to run a test? I neet to know the mAP of my task.

When i use the test_net.py from another project, there gose an error Traceback (most recent call last): File "faster_rcnn/test_net.py", line 85, in network = get_network(args.network_name) File "faster_rcnn/../lib/networks/factory.py", line 19, in get_network return FPN_test() File "faster_rcnn/../lib/networks/FPN_test.py", line 25, in init self.setup() File "faster_rcnn/../lib/networks/FPN_test.py", line 231, in setup .fc(n_classes, relu=False, name='cls_score') File "faster_rcnn/../lib/networks/network.py", line 34, in layer_decorated layer_output = op(self, layer_input, *args, *kwargs) File "faster_rcnn/../lib/networks/network.py", line 390, in fc dim = d TypeError: unsupported operand type(s) for *=: 'int' and 'NoneType'

How can i fix this?

Thx again :) @xmyqsh

chl916185 commented 7 years ago

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_ops.py", line 85, in call ret = func(*args) File "./faster_rcnn/../lib/rpn_msr/anchor_target_layer.py", line 144, in anchor_target_layer gt_argmax_overlaps = overlaps.argmax(axis=0) # G ValueError: attempt to get argmax of an empty sequence

When I met the above training VOC2007 error, how do you solve?@ @xmyqsh @BestSongEver

chl916185 commented 7 years ago

how do you solve this problem? @BestSongEver

BestSongEver commented 7 years ago

Sorry, i never met this issue. But i just checked it on google. It might caused by "Because the ratio of images width and heights is too small or large" Hope it helpful. @chl916185

chl916185 commented 7 years ago

Thank you, it is really inappropriate three pictures, I didn't use them, problem solved, but How to run test_net.py? I met the same problem with you. Traceback (most recent call last): File "./faster_rcnn/test_net.py", line 83, in network = get_network(args.network_name) File "./faster_rcnn/../lib/networks/factory.py", line 19, in get_network return FPN_test() File "./faster_rcnn/../lib/networks/FPN_test.py", line 25, in init self.setup() File "./faster_rcnn/../lib/networks/FPN_test.py", line 231, in setup .fc(n_classes, relu=False, name='cls_score') File "./faster_rcnn/../lib/networks/network.py", line 34, in layer_decorated layer_output = op(self, layer_input, *args, *kwargs) File "./faster_rcnn/../lib/networks/network.py", line 391, in fc dim = dimd TypeError: unsupported operand type(s) for *: 'int' and 'NoneType' @BestSongEver

xmyqsh commented 7 years ago

@chl916185 @BestSongEver hi there, I've updated anchors filtering logic in proposal target layer to cope with the problem encountered in low h/w ratio images

I will check the test_net latter

chl916185 commented 7 years ago

When i use the test_net.py from another project, there gose an error:

(<tf.Tensor 'rpn_rois/rpn_rois_P2:0' shape=(?, 5) dtype=float32>, <tf.Tensor 'rpn_rois/rpn_rois_P3:0' shape=(?, 5) dtype=float32>, <tf.Tensor 'rpn_rois/rpn_rois_P4:0' shape=(?, 5) dtype=float32>, <tf.Tensor 'rpn_rois/rpn_rois_P5:0' shape=(?, 5) dtype=float32>) [<tf.Tensor 'P2/BiasAdd:0' shape=(?, ?, ?, 256) dtype=float32>, <tf.Tensor 'P3/BiasAdd:0' shape=(?, ?, ?, 256) dtype=float32>, <tf .Tensor 'P4/BiasAdd:0' shape=(?, ?, ?, 256) dtype=float32>, <tf.Tensor 'P5/BiasAdd:0' shape=(?, ?, ?, 256) dtype=float32>, (<tf.Te nsor 'rpn_rois/rpn_rois_P2:0' shape=(?, 5) dtype=float32>, <tf.Tensor 'rpn_rois/rpn_rois_P3:0' shape=(?, 5) dtype=float32>, <tf.Te nsor 'rpn_rois/rpn_rois_P4:0' shape=(?, 5) dtype=float32>, <tf.Tensor 'rpn_rois/rpn_rois_P5:0' shape=(?, 5) dtype=float32>)] Traceback (most recent call last): File "./faster_rcnn/test_net.py", line 78, in network = get_network(args.network_name) File "./faster_rcnn/../lib/networks/factory.py", line 19, in get_network return FPN_test() File "./faster_rcnn/../lib/networks/FPN_test.py", line 25, in init self.setup() File "./faster_rcnn/../lib/networks/FPN_test.py", line 354, in setup .fc(n_classes, relu=False, name='cls_score') File "./faster_rcnn/../lib/networks/network.py", line 34, in layer_decorated layer_output = op(self, layer_input, *args, **kwargs) File "./faster_rcnn/../lib/networks/network.py", line 405, in fc regularizer=self.l2_regularizer(cfg.TRAIN.WEIGHT_DECAY)) File "./faster_rcnn/../lib/networks/network.py", line 96, in make_var return tf.get_variable(name, shape, initializer=initializer, trainable=trainable, regularizer=regularizer) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 988, in get_variable custom_getter=custom_getter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 890, in get_variable custom_getter=custom_getter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 348, in get_variable validate_shape=validate_shape) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 333, in _true_getter caching_device=caching_device, validate_shape=validate_shape) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py", line 639, in _get_single_variable name, "".join(traceback.format_list(tb)))) ValueError: Variable cls_score/weights already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

File "./faster_rcnn/../lib/networks/network.py", line 96, in make_var return tf.get_variable(name, shape, initializer=initializer, trainable=trainable, regularizer=regularizer) File "./faster_rcnn/../lib/networks/network.py", line 405, in fc regularizer=self.l2_regularizer(cfg.TRAIN.WEIGHT_DECAY)) File "./faster_rcnn/../lib/networks/network.py", line 34, in layer_decorated layer_output = op(self, layer_input, *args, **kwargs) When I was loading the trained model: network_name = 'FPN_test' network = get_network(network_name) print 'Use network {:s} in training'.format(network_name) @BestSongEver @xmyqsh