Closed PEE8 closed 4 years ago
did you find any solution?
i uninstalled anaconda and python and reinstalled anaconda and python 3.7 I did try to run all the files again only two files transfer_FCN and inference is giving errors(new_1.docx) once i fix them may be we can create HDF5 file
when you run transfer_FCN you must write the model in the terminal, for example python transfer_FCN Vgg16 or python transfer_FCN ResNet50
and I don't know what it's the error of inference, I'm try to run train.py but I have the error of the file HDF5
ok. but i am running the code on spyder so how do i give the command to run transfer_FCN Vgg16 or python transfer_FCN ResNet50? are you running the same code of train.py from the keras-FCN link
I tried in spyder and you need to go to run, configuration per file, general settings, you choose 'command line' and write Vgg16 or ResNet50
yes the same, I just change the paths to my dataset, classes and in the line of 'checkpoint_weights.hdf5 ' I wrote the file that your download of get_wieght_path and transfer_FCN
It's normal , that is not a error, you need to wait
when i give ResNet50 in the command line of run
runfile('C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz/transfer_FCN.py', args='ResNet50', wdir='C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz')
Reloaded modules: get_weight_path2, resnet_helpers2
C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz/transfer_FCN.py:91: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(64, (7, 7), name="conv1", strides=(2, 2), padding="same")
x = Convolution2D(64, (7, 7), subsample=(2, 2), border_mode='same', name='conv1')(img_input)
Traceback (most recent call last):
File "
File "C:\Users\Prisilla\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)
File "C:\Users\Prisilla\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz/transfer_FCN.py", line 148, in
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz/transfer_FCN.py", line 134, in transfer_FCN_ResNet50 if index.has_key(layer.name):
AttributeError: 'dict' object has no attribute 'has_key'
look #3 there resolve that problem
yes . I did the same first i run get_weights_path.py and followed by transfer_FCN.py still the above error.
https://stackoverflow.com/questions/33727149/dict-object-has-no-attribute-has-key says 'has_key' is removed in python 3
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz/transfer_FCN.py", line 134, in transfer_FCN_ResNet50 if index.has_key(layer.name):
AttributeError: 'dict' object has no attribute 'has_key'
in the line 134 you need to write this code:
if layer.name in index:
index[layer.name].set_weights(weights)
yes i did the same and waiting for execution will it take so long for execution I closed everything and restarted but then it is taking long
runfile('C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz/transfer_FCN.py', args='ResNet50', wdir='C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz')
Reloaded modules: get_weight_path2, resnet_helpers2
C:/Users/Prisilla/Desktop/Semantics/keras_FCN/xyz/transfer_FCN.py:91: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(64, (7, 7), name="conv1", strides=(2, 2), padding="same")
x = Convolution2D(64, (7, 7), subsample=(2, 2), border_mode='same', name='conv1')(img_input)
Successfully transformed!
yes ! it worked finally (transfer_FCN.py for ResNet50)
The model is fine, but in transfer_FCN in the Vgg16 method you need to change the same code
if layer.name in index:
index[layer.name].set_weights(weights)
yes. i did for Vgg16 and ResNet50 method
My keras version is 2.2.2, is it because of keras version . I am getting userwarning
https://groups.google.com/forum/#!topic/keras-users/BT2ZA_8kBqQ It says input_shape may be wrong
what is the keras version. you are working?
train.py works with small error when i run after transfer_FCN ResNet50
================================== Total params: 23,630,741 Trainable params: 23,577,621 Non-trainable params: 53,120
Traceback (most recent call last):
File "
File "C:\Users\Prisilla\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)
File "C:\Users\Prisilla\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/train2.py", line 233, in
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/train2.py", line 140, in train steps_per_epoch = int(np.ceil(get_file_len(train_file_path) / float(batch_size)))
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/train2.py", line 133, in get_file_len fp = open(file_path)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Prisilla/.keras/datasets/VOC2012/combined_imageset_train.txt'
================================== Total params: 23,630,741 Trainable params: 23,577,621 Non-trainable params: 53,120
Traceback (most recent call last):
File "
File "C:\Users\Prisilla\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)
File "C:\Users\Prisilla\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/train2.py", line 233, in
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/train2.py", line 140, in train steps_per_epoch = int(np.ceil(get_file_len(train_file_path) / float(batch_size)))
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Prisilla/.keras/datasets/VOC2012/combined_imageset_train.txt'
I'm using Keras 2.2.0, Tensorflor 1.8 and python 3.6
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Prisilla/.keras/datasets/VOC2012/combined_imageset_train.txt'
that is the direction(path) of your dataset? because maybe the script doesn't found the dataset
train.py is unable to train the model, i changed accordingly but then i getting the .error
---> File "C:\Users\Prisilla\Desktop\Semantics\keras_FCN\xyz\SegDataGenerator.py", line 174, in init fp = open(file_path)
---> FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Prisilla/.keras/VOCdevkit/VOC2012/ImageSets/Segmentation/train.txt' --> unable to create checkpoint_weights.hdf5
inference.py file is showing error File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/Sinference.py", line 92, in results = Sinference(model_name, weight_file, image_size, image_list, data_dir, label_dir)
File "C:/Users/Prisilla/Desktop/Semantics/keras_FCN/Sinference.py", line 35, in Sinference model.load_weights(checkpoint_path, by_name=True)
OSError: Unable to open file (unable to open file: name = 'C:\Users\Prisilla\Desktop\Semantics\keras_FCN\Models/DenseNet_FCN\checkpoint_weights.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
Can any one tell what changes can be done to run the model. I am trying to learn and work on semantic segmentation... but the code looks like not executing