unet
unet copied to clipboard
The program reported an error when I ran it on colab
The Error is as follows. Using TensorFlow backend. WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:66: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4479: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:148: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3733: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate
instead of keep_prob
. Rate should be set to rate = 1 - keep_prob
.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:2239: The name tf.image.resize_nearest_neighbor is deprecated. Please use tf.compat.v1.image.resize_nearest_neighbor instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.
/content/drive/My Drive/unet/model.py:55: UserWarning: Update your Model
call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("co...)
model = Model(input = inputs, output = conv10)
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/optimizers.py:793: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3657: The name tf.log is deprecated. Please use tf.math.log instead.
WARNING:tensorflow:From /tensorflow-1.15.0/python3.6/tensorflow_core/python/ops/nn_impl.py:183: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1033: The name tf.assign_add is deprecated. Please use tf.compat.v1.assign_add instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1020: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3005: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
Epoch 1/1
Found 0 images belonging to 1 classes.
Found 0 images belonging to 1 classes.
Traceback (most recent call last):
File "/content/drive/My Drive/unet/main.py", line 18, in
Thank you for your answer
I'm not sure but according to the error you've got its relating to the directory of your dataset: Epoch 1/1 Found 0 images belonging to 1 classes. Found 0 images belonging to 1 classes make sure if the directory of your dataset is correct
I'm not sure but according to the error you've got its relating to the directory of your dataset: Epoch 1/1 Found 0 images belonging to 1 classes. Found 0 images belonging to 1 classes make sure if the directory of your dataset is correct
Thank u very much!
how to test this model???
#evalution loss_test,accuracy_test = model.evaluate(x_test,y_test) #You should change the x_test and the y_test.
print('\nloss_test',loss_test) print('accuracy_test',accuracy_test)
thanks @djahdkjqbwfkb1213 . my predicted image is simply a grey box. Its not segmented image. Please help
@manvirvirk try this pice of code as addition to original one , hope will help :
import cv2 import numpy as np
def saveResult(save_path,npyfile,flag_multi_class = False,num_class = 2): for i,item in enumerate(npyfile): if flag_multi_class: img = labelVisualize(num_class,COLOR_DICT,item)
else:
img=item[:,:,0]
print(np.max(img),np.min(img))
img[img>0.5]=1
img[img<=0.5]=0
print(np.max(img),np.min(img))
io.imsave(os.path.join(save_path,"%d_predict.jpg"%i),img)
where to add this piece of code???
On Wed, Apr 8, 2020 at 3:26 PM tamaraalshekhli [email protected] wrote:
@manvirvirk https://github.com/manvirvirk try this pice of code as addition to original one , hope will help :
import cv2 import numpy as np
def saveResult(save_path,npyfile,flag_multi_class = False,num_class = 2): for i,item in enumerate(npyfile): if flag_multi_class: img = labelVisualize(num_class,COLOR_DICT,item)
else: img=item[:,:,0] print(np.max(img),np.min(img)) img[img>0.5]=1 img[img<=0.5]=0 print(np.max(img),np.min(img)) io.imsave(os.path.join(save_path,"%d_predict.jpg"%i),img)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zhixuhao/unet/issues/173#issuecomment-610865910, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAEAQDVRZPCHOBJ6YHRHELRLRC5PANCNFSM4LTNVTZQ .
@tamaraalshekhli in which file we need to add this??
just right after this part def labelVisualize(num_class,color_dict,img): img = img[:,:,0] if len(img.shape) == 3 else img img_out = np.zeros(img.shape + (3,)) for i in range(num_class): img_out[img == i,:] = color_dict[i] return img_out / 255
def saveResult(save_path,npyfile,flag_multi_class = False,num_class = 2): for i,item in enumerate(npyfile): img = labelVisualize(num_class,COLOR_DICT,item) if flag_multi_class else item[:,:,0] io.imsave(os.path.join(save_path,"%d_predict.png"%i),img) in data.py
I really want to know how you solved this problem, thank you very much.
I have compiled a list of frequently asked questions that I have encountered. You can find it here. Hope it helps!