DetectionTeamUCAS / NAS_FPN_Tensorflow

NAS-FPN: Learning Scalable Feature Pyramid Architecture for Object Detection.
https://arxiv.org/abs/1904.07392
MIT License
213 stars 62 forks source link

ValueError: Dimensions must be equal, but are 256 and 384 for 'tower_0/build_pyramid/build_P4/add' (op: 'Add') with input shapes: [1,?,?,256], [1,?,?,384]. #14

Open yzjdz opened 5 years ago

yzjdz commented 5 years ago

I try to training my dataset, and i have reference the three steps in README.md, I use the pretrained weights resnet_v1_50.ckpt, and i modify the $PATH_ROOT/libs/configs/cfgs.py and $PATH_ROOT/libs/label_name_dict/lable_dict.py and $PATH_ROOT/data/io/read_tfrecord.py, the NET_NAME has been alter with "resnet_v1_50", However ,after "python ./tools/multi_gpu_train.py",the error msg: ++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++-- ./NAS_FPN_Tensorflow-master WARNING:tensorflow:From multi_gpu_train.py:123: get_or_create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version. Instructions for updating: Please switch to tf.train.get_or_create_global_step tfrecord path is --> ./NAS_FPN_Tensorflow-master/data/tfrecord/occlusion_recognition_train* Traceback (most recent call last): File "./envs/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1589, in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 256 and 384 for 'tower_0/build_pyramid/build_P4/add' (op: 'Add') with input shapes: [1,?,?,256], [1,?,?,384].

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "multi_gpu_train.py", line 352, in train() File "multi_gpu_train.py", line 212, in train gtboxes_batch=gtboxes_and_label) File "../libs/networks/build_whole_network.py", line 386, in build_whole_detection_network P_list = self.build_base_network(input_img_batch) File "../libs/networks/build_whole_network.py", line 35, in build_base_network return resnet.resnet_base(input_img_batch, scope_name=self.base_network_name, is_training=self.is_training) File "../libs/networks/resnet.py", line 189, in resnet_base scope='build_P%d' % level) File "../libs/networks/resnet.py", line 63, in fusion_two_layer add_f = 0.5upsample_p + 0.5reduce_dim_c File "./envs/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 847, in binary_op_wrapper return func(x, y, name=name) File "./envs/anaconda/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 297, in add "Add", x=x, y=y, name=name) File "./envs/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "./envs/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "./anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1756, in init control_input_ops) File "./envs/anaconda/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1592, in _create_c_op raise ValueError(str(e)) ValueError: Dimensions must be equal, but are 256 and 384 for 'tower_0/build_pyramid/build_P4/add' (op: 'Add') with input shapes: [1,?,?,256], [1,?,?,384].

napatnicky commented 5 years ago

i have a same issue too. Did you solve it?

Schneey commented 4 years ago

I have a same issue too.

Schneey commented 4 years ago

This problem occurs because the number of channels is different at the time of fusion. So set the FPN_CHANNEL in the cfgs.py file to 256. May be helpful