Hello
when I ran the Training I got this error;
ValueError: Could not find a format to read the specified file in single-image mode
the full error message is :
`ERROR:root:Error processing image {'id': 0, 'source': 'shapes', 'path': '../newdata/valid/jpg\\C10000_0001_Band_10.jpg', 'mask_path': '../newdata/valid/jpg_mask\\C10000_0001_Band_10.jpg', 'width': 224, 'height': 224}
Traceback (most recent call last):
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1604, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1163, in load_image_gt
mask, class_ids = dataset.load_mask(image_id)
File "D:\segmentation-unet-maskrcnn\maskRCNN\mrcnn_dataset.py", line 51, in load_mask
_mask = skimage.io.imread(_mask_path, 0)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 182, in get_reader
"Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in single-image mode
ERROR:root:Error processing image {'id': 3, 'source': 'shapes', 'path': '../newdata/valid/jpg\\C20001_0001_Band_9.jpg', 'mask_path': '../newdata/valid/jpg_mask\\C20001_0001_Band_9.jpg', 'width': 224, 'height': 224}
Traceback (most recent call last):
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1604, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1163, in load_image_gt
mask, class_ids = dataset.load_mask(image_id)
File "D:\segmentation-unet-maskrcnn\maskRCNN\mrcnn_dataset.py", line 51, in load_mask
_mask = skimage.io.imread(_mask_path, 0)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 182, in get_reader
"Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in single-image mode
ERROR:root:Error processing image {'id': 2, 'source': 'shapes', 'path': '../newdata/valid/jpg\\C20001_0001_Band_10.jpg', 'mask_path': '../newdata/valid/jpg_mask\\C20001_0001_Band_10.jpg', 'width': 224, 'height': 224}
Traceback (most recent call last):
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1604, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1163, in load_image_gt
mask, class_ids = dataset.load_mask(image_id)
File "D:\segmentation-unet-maskrcnn\maskRCNN\mrcnn_dataset.py", line 51, in load_mask
_mask = skimage.io.imread(_mask_path, 0)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 182, in get_reader
"Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in single-image mode
ERROR:root:Error processing image {'id': 1, 'source': 'shapes', 'path': '../newdata/valid/jpg\\C10000_0001_Band_9.jpg', 'mask_path': '../newdata/valid/jpg_mask\\C10000_0001_Band_9.jpg', 'width': 224, 'height': 224}
Traceback (most recent call last):
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1604, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1163, in load_image_gt
mask, class_ids = dataset.load_mask(image_id)
File "D:\segmentation-unet-maskrcnn\maskRCNN\mrcnn_dataset.py", line 51, in load_mask
_mask = skimage.io.imread(_mask_path, 0)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 182, in get_reader
"Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in single-image mode
ERROR:root:Error processing image {'id': 1, 'source': 'shapes', 'path': '../newdata/valid/jpg\\C10000_0001_Band_9.jpg', 'mask_path': '../newdata/valid/jpg_mask\\C10000_0001_Band_9.jpg', 'width': 224, 'height': 224}
Traceback (most recent call last):
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1604, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1163, in load_image_gt
mask, class_ids = dataset.load_mask(image_id)
File "D:\segmentation-unet-maskrcnn\maskRCNN\mrcnn_dataset.py", line 51, in load_mask
_mask = skimage.io.imread(_mask_path, 0)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 182, in get_reader
"Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in single-image mode
ERROR:root:Error processing image {'id': 0, 'source': 'shapes', 'path': '../newdata/valid/jpg\\C10000_0001_Band_10.jpg', 'mask_path': '../newdata/valid/jpg_mask\\C10000_0001_Band_10.jpg', 'width': 224, 'height': 224}
Traceback (most recent call last):
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1604, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1163, in load_image_gt
mask, class_ids = dataset.load_mask(image_id)
File "D:\segmentation-unet-maskrcnn\maskRCNN\mrcnn_dataset.py", line 51, in load_mask
_mask = skimage.io.imread(_mask_path, 0)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 182, in get_reader
"Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in single-image mode
Traceback (most recent call last):
File "D:\segmentation-unet-maskrcnn\maskRCNN\test_train.py", line 68, in <module>
layers='all')
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 2198, in train
validation_data=next(val_generator),
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1604, in data_generator
use_mini_mask=config.USE_MINI_MASK)
File "D:\segmentation-unet-maskrcnn\maskRCNN\model.py", line 1163, in load_image_gt
mask, class_ids = dataset.load_mask(image_id)
File "D:\segmentation-unet-maskrcnn\maskRCNN\mrcnn_dataset.py", line 51, in load_mask
_mask = skimage.io.imread(_mask_path, 0)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 265, in imread
reader = read(uri, format, "i", **kwargs)
File "C:\Users\S\Anaconda3\lib\site-packages\imageio\core\functions.py", line 182, in get_reader
"Could not find a format to read the specified file in %s mode" % modename
ValueError: Could not find a format to read the specified file in single-image mode`
my dataset include 2 folders. one satellite image chips and another mask images as label , both in jpg format.
my dataset class is:
`class LolDataset(utils.Dataset):
def load_LOL(self, datasetdir):
for i in range(inputConfig.NUM_CLASSES):
self.add_class("shapes", i, inputConfig.CLASS_DICT[i+1] )
else:
image_dir = os.path.join(datasetdir, 'jpg')
print ('image_dir is', image_dir)
mask_dir = os.path.join(datasetdir, 'jpg_mask')
image_names = next(os.walk(image_dir))[2]
for i in range(len(image_names)):
self.add_image("shapes", image_id = i,
path=os.path.join(image_dir, image_names[i]),
mask_path=os.path.join(mask_dir, image_names[i]),
width = inputConfig.IMAGE_WIDTH,
height = inputConfig.IMAGE_HEIGHT)
def load_image(self, image_id):
info = self.image_info[image_id]
image_path = info['path']
image = cv2.imread(image_path)
if image.ndim != 3:
image = skimage.color.gray2rgb(image)
return image
def load_mask(self, image_id):
info = self.image_info[image_id]
mask_path = info['mask_path']
valid_mask = []
for _mask_path in mask_path:
_mask = skimage.io.imread(_mask_path, 0)
if _mask.max() == _mask.min():
pass
else:
valid_mask.append(_mask_path)
count = len(valid_mask)
mask = np.zeros([info['height'], info['width'], count], 'uint8')
shapes = []
for i in range(count):
img_array = skimage.io.imread(valid_mask[i], 0)
mask[:, :, i:i+1] = np.expand_dims(img_array, axis=2)
valid_mask_name=[]
count_m = len(valid_mask_name)
fn_img, ext = os.path.splitext(valid_mask[i])
if fn_img[-18:-17] == 1:
valid_name = fn_img +"_jo.jpg"
valid_mask_name.append(valid_name)
else:
valid_name = fn_img +"_yonje.jpg"
valid_mask_name.append(valid_name)
for i in range(count_m):
if fn_img.split('_')[-1] == 'merged':
shapes.append(fn_img.split('/')[-1].split('_')[0])
else:
shapes.append(fn_img.split('_')[-1])
# Map class names to class IDs.
class_ids = np.array([self.class_names.index(s) for s in shapes])
return mask, class_ids`
Hello when I ran the Training I got this error; ValueError: Could not find a format to read the specified file in single-image mode the full error message is :
my dataset include 2 folders. one satellite image chips and another mask images as label , both in jpg format.
my dataset class is: