Closed theimgclist closed 6 years ago
Hi,Do you know how to solve the following issue? thank you for helping me.
ImportError Traceback (most recent call last)
/apsarapangu/disk6/wuting/FgSegNet/FgSegNet-master/FgSegNet/FgSegNet.py in
/apsarapangu/disk6/wuting/FgSegNet/FgSegNet-master/FgSegNet/FgSegNetModule.py in
ImportError: cannot import name 'MyUpSampling2D'
Hi @Mary233. The error must be because of not properly copying the utils files that were shared. In the project's readme file, they have given us the instructions to copy the files from utils folder into the installed keras directory.
The file convolutional.py from utils folder has the class MyUpSampling2D. This class does not exist in the convolutional.py file which exists by default in keras installation. Try copying the convolutional.py file from utils into your keras directory at the path keras/layers/convolutional.py. As mentioned this file already exists so you have to replace it.
Thank you very much! I solved the issue by your answer. and, I have another issue, do you know how to solve it? thanks again! when I run the FgSegNet.py, the following issue occured.
ValueError Traceback (most recent call last)
/apsarapangu/disk6/wuting/FgSegNet/FgSegNet-master/FgSegNet/FgSegNet.py in
/apsarapangu/disk6/wuting/FgSegNet/FgSegNet-master/FgSegNet/FgSegNet.py in train(results, scene, mdl_path, log_dir, vgg_weights_path) 147 redu = keras.callbacks.ReduceLROnPlateau(monitor='val_loss', factor=reduce_factor, patience=num_patience, verbose=1, mode='auto', epsilon=0.0001, cooldown=0, min_lr=0) 148 model.fit([results[0], results[1], results[2]], results[3], validation_split=0.2, epochs=epoch, batch_size=batch_size, --> 149 callbacks=[redu, chk, tb], verbose=1, class_weight=results[4], shuffle = True) 150 151 del model, results, tb, chk, redu
/apsarapangu/disk6/wuting/Anaconda3/lib/python3.5/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, **kwargs) 1356 class_weight=class_weight, 1357 check_batch_axis=False, -> 1358 batch_size=batch_size) 1359 # Prepare validation data. 1360 if validation_data:
/apsarapangu/disk6/wuting/Anaconda3/lib/python3.5/site-packages/keras/engine/training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_batch_axis, batch_size) 1232 self._feed_input_shapes, 1233 check_batch_axis=False, -> 1234 exception_prefix='input') 1235 y = _standardize_input_data(y, self._feed_output_names, 1236 output_shapes,
/apsarapangu/disk6/wuting/Anaconda3/lib/python3.5/site-packages/keras/engine/training.py in _standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix) 138 ' to have shape ' + str(shapes[i]) + 139 ' but got array with shape ' + --> 140 str(array.shape)) 141 return arrays 142
ValueError: Error when checking input: expected ip_scale3 to have shape (None, 85, 142, 3) but got array with shape (50, 85, 143, 3)
You can try to check the version of your keras, the right version is keras2.0.6
I followed the steps mentioned in the README. After I downloaded the dataset and placed it in the right directory, I used FgSegNet.py to start the training. Pasting below the error log:
Did I miss something?