Merge layer
Closed this issue · 13 comments
HI, i have a problem while loading the model, this is exactly what python says:
ValueError: Unknown layer: Merge
Please, help to fix that, seems like something is not defined.
This is because the model was built with an old version of Keras and the Merge layer has now been deprecated. I have uploaded a Keras 2 version of the street view model that should work. Note that you would need to compile the model manually before calling fit
or evaluate
.
Thanks for answering! i can not see where did you uploaded the new version, did you? o i need to compile this code? i come from your blog, and downloaded the files from there...
It is in the same link as before: https://drive.google.com/open?id=0B9eNEi5uvOI1SjQ5M2tQY3ZMM1U
@d4nst sorry, that means that i have to build the whole model? i'm running the train script with the first model since yesterday in a xeon with 6 cores and 12 logic cores to 3.6 GHZ and it is still on epoch 3 of 50.
@d4nst I'm having another problem, look, i tried to use the model you uploaded and i put the instruction to compile, then, when i send some images, without compile the model and compiling it (both ways), python shows this error:
Using TensorFlow backend.
Loading model...
2018-06-08 18:16:59.864514: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
/home/jaisirb/miniconda3/lib/python3.6/site-packages/keras/engine/saving.py:270: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
Processsing input image(s)...
correct_rotation.py:43: UserWarning: The semantics of the Keras 2 argument steps_per_epoch
is not the same as the Keras 1 argument samples_per_epoch
. steps_per_epoch
is the number of batches to draw from the generator at each epoch. Basically steps_per_epoch = samples_per_epoch/batch_size. Similarly nb_val_samples
->validation_steps
and val_samples
->steps
arguments have changed. Update your method calls accordingly.
val_samples=len(image_paths)
correct_rotation.py:43: UserWarning: Update your predict_generator
call to the Keras 2 API: predict_generator(<utils.Rot..., steps=0)
val_samples=len(image_paths)
Traceback (most recent call last):
File "/home/jaisirb/miniconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 52, in _wrapfunc
return getattr(obj, method)(*args, **kwds)
AttributeError: 'list' object has no attribute 'argmax'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "correct_rotation.py", line 84, in
args.batch_size, args.crop)
File "correct_rotation.py", line 46, in process_images
predicted_angles = np.argmax(predictions, axis=1)
File "/home/jaisirb/miniconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 1004, in argmax
return _wrapfunc(a, 'argmax', axis=axis, out=out)
File "/home/jaisirb/miniconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 62, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File "/home/jaisirb/miniconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 42, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
numpy.core._internal.AxisError: axis 1 is out of bounds for array of dimension 1
What arguments are you passing to the correct_rotation.py
script? I just run it with the latest Keras version and the Keras 2 model and everything seems to be working fine on my side.
Also, training this model on a CPU will take a lot of time... You should use a GPU instead.
I'm using this arguments:
python correct_rotation.py models/rotnet_street_view_2.hdf5 images -o output -c
That looks fine. I can't reproduce your issue on my machine so it is hard to say what is going on... What version of Keras and Python are you using? What format are the images inside the "images" directory? Did you make any modifications to the code?
I'm trying to run the training on a Nvidia quadro p4000 but i still have an error, i think it could be the number of workers. Look:
==================================================================================================
Total params: 59,714,792
Trainable params: 59,661,672
Non-trainable params: 53,120
Epoch 1/50
2018-06-09 12:38:27.642743: W T:\src\github\tensorflow\tensorflow\core\common_runtime\bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 112.50MiB. The caller indicates that this is not a failure, but may me
an that there could be performance gains if more memory were available.
2018-06-09 12:38:27.663360: W T:\src\github\tensorflow\tensorflow\stream_executor\cuda\cuda_dnn.cc:2640]
2018-06-09 12:38:37.668899: W T:\src\github\tensorflow\tensorflow\core\common_runtime\bfc_allocator.cc:275] Allocator (GPU_0_bfc) ran out of memory trying to allocate 98.00MiB. Current allocation summary follows.
2018-06-09 12:38:37.679165: I T:\src\github\tensorflow\tensorflow\core\common_runtime\bfc_allocator.cc:630] Bin (256): Total Chunks: 932, Chunks in use: 930. 233.0KiB allocated for chunks. 232.5KiB in use in bin. 37.9KiB client-requeste
d in use in bin.
@d4nst i solved the problem loading images, the problem was the format, i added to the list, but now i have this one, i'm trying to run it on a GPU as you said, i'm using a Nvidia quadro p4000, but python shows that error, i have the lastest versions of all the programs required.
That is a memory issue. Basically the batch size is too large for your GPU and it is running out of memory. Try reducing the batch size parameter until it doesn't fail.
@d4nst Thanks! now i'm waiting for the training, it's running on gpu and it's much faster.
Hi Jaishirb,
Can you please share the trained model, if it's done.
Thanks in advance.