unet
unet copied to clipboard
Camvid数据集训练问题
您好,我在借用您的unet网络跑Camvid数据集的时候遇到了下面的问题,希望您可以指导一下:
`Total params: 31,051,200 Trainable params: 31,051,200 Non-trainable params: 0
Epoch 1/10 Found 100 images belonging to 1 classes. Found 400 images belonging to 1 classes. Found 100 images belonging to 1 classes. Found 400 images belonging to 1 classes. 3/100 [========>.....................] - ETA: 3:58 - loss: 0.2298 - acc: 0.2382`
似乎所有图片都被判定属于同一个类别(belonging to 1 classes)?训练中acc确实会逐渐上升,最终达到1,但是使用test.py测试训练结果模型时得到的图片是全灰的(将data.py中COLOR_DICT的第一类颜色改为255,255,255的话会得到全白图像,感觉应该是把整个图像都分为第一类了)
看了之前几个issue,不知道是不是我的训练集图片路径设置错误,我是按如下路径设置的:
`
#path to images which are prepared to train a model
train_path = "E:/ljwgroupSRTP/unet/data/train"
image_folder = "image"
label_folder = "label"
valid_path = "E:/ljwgroupSRTP/unet/data/valid"
valid_image_folder ="image"
valid_label_folder = "label"
log_filepath = 'E:/ljwgroupSRTP/unet/log'`
训练用的py文件都在E:/ljwgroupSRTP/unet文件夹下,而我的图片路径如下图:
不知这样的情况下我的路径设置是否正确?
如果不是图片路径的设置问题,我修改的参数是以下这些代码,希望您能指正一下错误:
train.py:
`
flag_multi_class = True
num_classes = 32
dp = data_preprocess(train_path=train_path,image_folder=image_folder,label_folder=label_folder,
valid_path=valid_path,valid_image_folder=valid_image_folder,valid_label_folder=valid_label_folder,
flag_multi_class=flag_multi_class,
num_classes=num_classes)
data.py中我在原本的12中颜色基础上,自己编了20种颜色并加入COLOR_DICT中(我猜测这个应该只是在test预测中用于染色的,并不一定要与label图像颜色相同?)
class data_preprocess:
def __init__(self, train_path=None, image_folder=None, label_folder=None,
valid_path=None,valid_image_folder =None,valid_label_folder = None,
test_path=None, save_path=None,
img_rows=512, img_cols=512,
flag_multi_class=True,
num_classes = 32):
self.img_rows = img_rows
self.img_cols = img_cols
self.train_path = train_path
self.image_folder = image_folder
self.label_folder = label_folder
self.valid_path = valid_path
self.valid_image_folder = valid_image_folder
self.valid_label_folder = valid_label_folder
self.test_path = test_path
self.save_path = save_path
self.data_gen_args = dict(rotation_range=0.2,
width_shift_range=0.05,
height_shift_range=0.05,
shear_range=0.05,
zoom_range=0.05,
vertical_flip=True,
horizontal_flip=True,
fill_mode='nearest')
self.image_color_mode = "rgb"
self.label_color_mode = "rgb"
self.flag_multi_class = flag_multi_class
self.num_class = num_classes
self.target_size = (512, 512)
self.img_type = 'png'
test.py中:
test_path = "E:/ljwgroupSRTP/unet/data/test/image"
# save the predict images
save_path = "E:/ljwgroupSRTP/unet/data/test/predict"
dp = data_preprocess(test_path=test_path,save_path=save_path,flag_multi_class=True,num_classes=32)`
请问我这几个文件中是不是有改错或者漏改的内容?或者是data_Pretreatment.py和label_visualization.py中也有需要修改的内容?
非常感谢您的指导!
已经解决了,不好意思
已经解决了,不好意思
请问你是怎么解决,分享一下呗
mark
您好,我在借用您的unet网络跑Camvid数据集的时候遇到了下面的问题,希望您可以指导一下:
`Total params: 31,051,200 Trainable params: 31,051,200 Non-trainable params: 0
Epoch 1/10 Found 100 images belonging to 1 classes. Found 400 images belonging to 1 classes. Found 100 images belonging to 1 classes. Found 400 images belonging to 1 classes. 3/100 [========>.....................] - ETA: 3:58 - loss: 0.2298 - acc: 0.2382`
似乎所有图片都被判定属于同一个类别(belonging to 1 classes)?训练中acc确实会逐渐上升,最终达到1,但是使用test.py测试训练结果模型时得到的图片是全灰的(将data.py中COLOR_DICT的第一类颜色改为255,255,255的话会得到全白图像,感觉应该是把整个图像都分为第一类了)
看了之前几个issue,不知道是不是我的训练集图片路径设置错误,我是按如下路径设置的: ` #path to images which are prepared to train a model
train_path = "E:/ljwgroupSRTP/unet/data/train" image_folder = "image" label_folder = "label" valid_path = "E:/ljwgroupSRTP/unet/data/valid" valid_image_folder ="image" valid_label_folder = "label" log_filepath = 'E:/ljwgroupSRTP/unet/log'`
训练用的py文件都在E:/ljwgroupSRTP/unet文件夹下,而我的图片路径如下图:
![]()
不知这样的情况下我的路径设置是否正确?
如果不是图片路径的设置问题,我修改的参数是以下这些代码,希望您能指正一下错误: train.py: ` flag_multi_class = True
num_classes = 32 dp = data_preprocess(train_path=train_path,image_folder=image_folder,label_folder=label_folder, valid_path=valid_path,valid_image_folder=valid_image_folder,valid_label_folder=valid_label_folder, flag_multi_class=flag_multi_class, num_classes=num_classes)
data.py中我在原本的12中颜色基础上,自己编了20种颜色并加入COLOR_DICT中(我猜测这个应该只是在test预测中用于染色的,并不一定要与label图像颜色相同?)
class data_preprocess:def __init__(self, train_path=None, image_folder=None, label_folder=None, valid_path=None,valid_image_folder =None,valid_label_folder = None, test_path=None, save_path=None, img_rows=512, img_cols=512, flag_multi_class=True, num_classes = 32): self.img_rows = img_rows self.img_cols = img_cols self.train_path = train_path self.image_folder = image_folder self.label_folder = label_folder self.valid_path = valid_path self.valid_image_folder = valid_image_folder self.valid_label_folder = valid_label_folder self.test_path = test_path self.save_path = save_path self.data_gen_args = dict(rotation_range=0.2, width_shift_range=0.05, height_shift_range=0.05, shear_range=0.05, zoom_range=0.05, vertical_flip=True, horizontal_flip=True, fill_mode='nearest') self.image_color_mode = "rgb" self.label_color_mode = "rgb" self.flag_multi_class = flag_multi_class self.num_class = num_classes self.target_size = (512, 512) self.img_type = 'png'
test.py中:
test_path = "E:/ljwgroupSRTP/unet/data/test/image"# save the predict images save_path = "E:/ljwgroupSRTP/unet/data/test/predict" dp = data_preprocess(test_path=test_path,save_path=save_path,flag_multi_class=True,num_classes=32)`
请问我这几个文件中是不是有改错或者漏改的内容?或者是data_Pretreatment.py和label_visualization.py中也有需要修改的内容?
非常感谢您的指导!
请问你是怎么解决的,请指导一下,谢谢
mark
请问你知道如何解决吗?
我是label图片用错了,应该用灰度图而不是这种彩色的可视化label,换成灰度图就解决了
我是label图片用错了,应该用灰度图而不是这种彩色的可视化label,换成灰度图就解决了
Found 367 images belonging to 1 classes. Found 101 images belonging to 1 classes. Found 367 images belonging to 1 classes. Found 101 images belonging to 1 classes. 我用的Camvid运行出现这个,你当时是怎么处理的呢?它的label是灰度图啊
我是label图片用错了,应该用灰度图而不是这种彩色的可视化label,换成灰度图就解决了
请问label用灰度图的话data.py中label_color_mode要设置成grayscale吗?还是就保持rgb呢?
需要改一下
在 2020-12-10 19:57:58,"lyricgoal" [email protected] 写道:
我是label图片用错了,应该用灰度图而不是这种彩色的可视化label,换成灰度图就解决了
请问label用灰度图的话data.py中label_color_mode要设置成grayscale吗?还是就保持rgb呢?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
我是label图片用错了,应该用灰度图而不是这种彩色的可视化label,换成灰度图就解决了
请问label用灰度图的话data.py中label_color_mode要设置成grayscale吗?还是就保持rgb呢?
您好!请问这个问题怎么解决,谢谢!
我是label图片用错了,应该用灰度图而不是这种彩色的可视化label,换成灰度图就解决了
您好,能否指导一下怎么解决这个问题,非常感谢!