AntreasAntoniou / MatchingNetworks

An attempt at replicating the Matching Networks for One Shot Learning in Tensorflow - Paper URL: https://arxiv.org/pdf/1606.04080.pdf
MIT License
327 stars 96 forks source link

ValueError when executing train_one_shot_learning_matching_network.py without any modification #20

Open YuanEric88 opened 5 years ago

YuanEric88 commented 5 years ago

Hi, I simply ran train_one_shot_learning_matching_network.py following guideline in the Readme file, then I met following error. Does anyone meet the same problem?

Traceback (most recent call last): | 0/1000 [00:00<?, ?it/s] File "train_one_shot_learning_matching_network.py", line 69, in sess=sess) File "/one_shot_learning/MatchingNetworks-master/experiment_builder.py", line 82, in run_training_epoch self.learning_rate: self.current_learning_rate}) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1128, in _run str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (1, 32, 20, 1) for Tensor 'target_image:0', which has shape '(1, 32, 28, 28, 1)'

aplusc98 commented 5 years ago

I got a similar error, were you able to solve it?

SYChen123 commented 4 years ago

I think there might be something wrong with your dataset or codes related to 'img_height' and 'img_width'. It's clearly that the shape of target_image and your input doesn't match.

AntreasAntoniou commented 4 years ago

I haven't updated this code for a while. I would not be surprised if one of the latest updates of tensorflow broke my code.

castleKing1997 commented 3 years ago

I haven't updated this code for a while. I would not be surprised if one of the latest updates of tensorflow broke my code.

Sir, i use the same version of tensorflow with you. but got the same error, could you please teach me how to fix it? this is the report

$ python train_one_shot_learning_matching_network.py --batch_size 32 --experiment_title omniglot_20_1_matching_network --total_epochs 200 --full_context_unroll_k 5 --classes_per_set 20 --samples_per_class 1 --use_full_context_embeddings False --use_mean_per_class_embeddings False --dropout_rate_value 0.0
Mapped data paths can't be found, remapping paths..
Get images from /home/luoc/Python-Lab/luoc/code/MatchingNetworks/MatchingNetworks/datasets/omniglot_dataset
100%|█████████████████████████████████████████████████████████████████████████████████| 32460/32460 [00:09<00:00, 3356.67it/s]
1623
1200 1411 1623
data {'train': 24000, 'val': 4220, 'test': 4240}
WARNING:tensorflow:From /home/luoc/Python-Lab/luoc/code/MatchingNetworks/MatchingNetworks/one_shot_learning_network.py:112: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
2020-10-15 10:50:03.480899: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-10-15 10:50:03.606723: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1212] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.8225
pciBusID: 0000:02:00.0
totalMemory: 7.92GiB freeMemory: 7.14GiB
2020-10-15 10:50:03.606752: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1312] Adding visible gpu devices: 0
2020-10-15 10:50:03.812563: I tensorflow/core/common_runtime/gpu/gpu_device.cc:993] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6895 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:02:00.0, compute capability: 6.1)
  0%|                                                                                                 | 0/200 [00:00<?, ?it/s]
Traceback (most recent call last):                                                                   | 0/1000 [00:00<?, ?it/s]
  File "train_one_shot_learning_matching_network.py", line 69, in <module>
    sess=sess)
  File "/home/luoc/Python-Lab/luoc/code/MatchingNetworks/MatchingNetworks/experiment_builder.py", line 82, in run_training_epoch
    self.learning_rate: self.current_learning_rate})
  File "/home/luoc/Python-envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 905, in run
    run_metadata_ptr)
  File "/home/luoc/Python-envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1113, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 32) for Tensor 'target_image:0', which has shape '(1, 32, 28, 28, 1)'

and this is my packages installed


numpy              1.15.0
opencv-python      4.4.0.42
tensorflow-gpu     1.6.0
torch              0.4.0
``
castleKing1997 commented 3 years ago

Hi, I simply ran train_one_shot_learning_matching_network.py following guideline in the Readme file, then I met following error. Does anyone meet the same problem?

Traceback (most recent call last): | 0/1000 [00:00<?, ?it/s] File "train_one_shot_learning_matching_network.py", line 69, in sess=sess) File "/one_shot_learning/MatchingNetworks-master/experiment_builder.py", line 82, in run_training_epoch self.learning_rate: self.current_learning_rate}) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1128, in _run str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (1, 32, 20, 1) for Tensor 'target_image:0', which has shape '(1, 32, 28, 28, 1)'

@YuanEric88 Hi, have you solved this issue? How did you solve it?