MarvinTeichmann / KittiSeg

A Kitti Road Segmentation model implemented in tensorflow.
MIT License
911 stars 403 forks source link

ResNet encoder not able to testing. #179

Open bruno-krinski opened 6 years ago

bruno-krinski commented 6 years ago

Hello. Someone can help me? I trained with the resnet50 and resnet101 models as encoder. The training and validation steps run without problem. But in the test step, this error occurs. Someone have some idea why? with the VGG-16 i testes without problems.

I tensorflow/core/kernels/logging_ops.cc:79] Shape of upscore2[1 16 16 2] I tensorflow/core/kernels/logging_ops.cc:79] Shape of upscore4[1 32 32 2] I tensorflow/core/kernels/logging_ops.cc:79] Shape of upscore32[1 256 256 2] 2018-07-11 16:19:10,358 INFO Evaluation Succesfull. Results: 2018-07-11 16:19:10,358 INFO [train] MaxF1 : 74.3414 2018-07-11 16:19:10,358 INFO [train] BestThresh : 88.2353 2018-07-11 16:19:10,359 INFO [train] Average Precision : 75.0402 2018-07-11 16:19:10,359 INFO [val] MaxF1 : 71.1898 2018-07-11 16:19:10,359 INFO [val] BestThresh : 86.6667 2018-07-11 16:19:10,359 INFO [val] Average Precision : 70.6470 2018-07-11 16:19:10,359 INFO Speed (msec) : 55.3155 2018-07-11 16:19:10,360 INFO Speed (fps) : 18.0781 2018-07-11 16:20:22,013 INFO Creating output on test data. 2018-07-11 16:20:22,017 INFO f: <open file 'RUNS/DUTOMRON_resnet50_fcn_2018_07_11_13.14/model_files/hypes.json', mode 'r' at 0x7f550865cdb0> Traceback (most recent call last): File "evaluate.py", line 122, in tf.app.run() File "/home/bakrinski/anaconda2/envs/KittiSeg/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "evaluate.py", line 113, in main kitti_test.do_inference(logdir) File "incl/evaluation/kitti_test.py", line 132, in do_inference image=image) File "incl/tensorvision/core.py", line 137, in build_inference_graph logits = modules['arch'].inference(hypes, image, train=False) File "RUNS/DUTOMRON_resnet50_fcn_2018_07_11_13.14/model_files/architecture.py", line 72, in inference x = _conv(x, 64, ksize=7, stride=2) File "RUNS/DUTOMRON_resnet50_fcn_2018_07_11_13.14/model_files/architecture.py", line 319, in _conv weight_decay=CONV_WEIGHT_DECAY) File "RUNS/DUTOMRON_resnet50_fcn_2018_07_11_13.14/model_files/architecture.py", line 308, in _get_variable trainable=trainable) File "/home/bakrinski/anaconda2/envs/KittiSeg/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 988, in get_variable custom_getter=custom_getter) File "/home/bakrinski/anaconda2/envs/KittiSeg/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 890, in get_variable custom_getter=custom_getter) File "/home/bakrinski/anaconda2/envs/KittiSeg/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 348, in get_variable validate_shape=validate_shape) File "/home/bakrinski/anaconda2/envs/KittiSeg/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 333, in _true_getter caching_device=caching_device, validate_shape=validate_shape) File "/home/bakrinski/anaconda2/envs/KittiSeg/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 660, in _get_single_variable "but instead was %s." % (name, shape)) ValueError: Shape of a new variable (scale1/weights) must be fully defined, but instead was (7, 7, ?, 64).

well, i found the problem. It worked after i add the line "image.set_shape([1, None, None, 3])" in the do_inference function in kitti_test.py file. Bellow the line "image = tf.expand_dims(image_pl, 0)". I copied from the do_analyze function in analyze.py file.

liuyangly25 commented 6 years ago

I had same issue. Your solution works like a charm @bruno-krinski

xxxy-931231 commented 6 years ago

@bruno-krinski HI I want to ask how to train the resnet101 models this is my error,and i don't where i can downroad the resnet101.npy can i see you code,Thank you!!!!! 46 # Call the main function, passing through any arguments 47 # to the final program. ---> 48 _sys.exit(main(_sys.argv[:1] + flags_passthrough)) 49 50

in main(_) 46 train.initialize_training_folder(hypes) 47 logging.info("Start training") ---> 48 train.do_training(hypes) /home/xieyan/test/KittiSeg/incl/tensorvision/train.py in do_training(hypes) 377 378 # prepaire the tv session --> 379 tv_sess = core.start_tv_session(hypes) 380 381 with tf.name_scope('Validation'): /home/xieyan/test/KittiSeg/incl/tensorvision/core.py in start_tv_session(hypes) 177 if 'init_function' in hypes: 178 _initalize_variables = hypes['init_function'] --> 179 _initalize_variables(hypes) 180 else: 181 init = tf.global_variables_initializer() /home/xieyan/test/KittiSeg/hypes/../encoder/resnet.py in _initalize_variables(hypes) 141 logging.error("Please download weights from here: {}" 142 .format('network_url')) --> 143 exit(1) 144 145 logging.info("Loading weights from disk.")
bruno-krinski commented 6 years ago

The link: ftp://mi.eng.cam.ac.uk/pub/mttt2/models/tensorflow_resnet/

I take it here: https://github.com/MarvinTeichmann/KittiSeg/issues/30

xxxy-931231 commented 6 years ago

Thank you very much!!! I will try it,maybe I am in china, i can't open the web

xxxy-931231 commented 6 years ago

I use VPN it can download!!!