-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
`import keras
from keras.models import model_from_json
import keras_segmentation as ks
from keras_segmentation import models
from keras_segmentation.models.unet import vgg_unet
train_images_folder = '/content/drive/MyDrive/Colab Notebooks/train_images/'
train_masks_folder = '/content/drive/MyDrive/Colab Notebooks/train_masks/'
model = vgg_unet( n_classes=2,
input_height=256,
input_width=256)
model.train(
train_images = train_images_folder,
train_annotations = train_masks_folder,
checkpoints_path = "/content/ckpts" , epochs=50 ,
auto_resume_checkpoint = True,
steps_per_epoch = 10
)`
When I run the above code I get the following error.
`Downloading data from https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5
58889256/58889256 [==============================] - 1s 0us/step
Verifying training dataset
0%| | 0/2452 [00:00<?, ?it/s]
The pixel values of the segmentation image /content/drive/MyDrive/Colab
Notebooks/train_masks/23.png violating range [0, 1]. Found maximum pixel value 255
Dataset not verified!
AssertionError Traceback (most recent call last)
in <cell line: 14>()
12 input_width=256)
13 # Training
---> 14 model.train(
15 train_images = train_images_folder,
16 train_annotations = train_masks_folder,
/content/image-segmentation-keras/keras_segmentation/train.py in train(model, train_images, train_annotations, input_height, input_width, n_classes, verify_dataset, checkpoints_path, epochs, batch_size, validate, val_images, val_annotations, val_batch_size, auto_resume_checkpoint, load_weights, steps_per_epoch, val_steps_per_epoch, gen_use_multiprocessing, ignore_zero_class, optimizer_name, do_augment, augmentation_name, callbacks, custom_augmentation, other_inputs_paths, preprocessing, read_image_type)
158 train_annotations,
159 n_classes)
--> 160 assert verified
161 if validate:
162 print("Verifying validation dataset")
AssertionError:`
I am using this code to do tumor segmentation. My dataset only has brain MRI images in png format and their tags. Below I have given the 23.png file and tag with the error.
when i normalize images in range [0,1] ı am not getting any error. but the images are completely black as below
How can i solve this problem?
I will be glad if you help.