bubbliiiing / hrnet-pytorch

这是一个hrnet-pytorch的库,可用于训练自己的语义分割数据集
MIT License
104 stars 16 forks source link

为什么目标像素点为1 #4

Open Thehonst opened 2 years ago

Thehonst commented 2 years ago

”需要改成,背景的像素点值为0,目标的像素点值为1“这是为什么呢,目标像素值为255不是与背景的对比度更高吗

Thehonst commented 2 years ago

"I need to change it to, the pixel value of the background is 0, and the pixel value of the target is 1" Why, the target pixel value of 255 is not higher contrast with the background

bubbliiiing commented 2 years ago

对比度高可还行……你是对图片分类又不是标签分类

Thehonst commented 2 years ago

There is a error "FileNotFoundError: [Errno 2] No such file or directory: 'VOCdevkit/VOC2007/JPEGImages/train/20160402_150942.jpg'",but I do not konw how to go about fixing it. In train.py file,the dataset path was be set to "VOCdevkit_path = 'VOCdevkit/'",while the code of reading images is "jpg = Image.open(os.path.join(os.path.join(self.dataset_path,"VOC2007/"),name))" in dataloader.py file. It is right path that be presented in this error and the images are no problem.

bubbliiiing commented 2 years ago

You cut a picture for me, about the wrong picture

Thehonst commented 2 years ago

Thanks, the issue has been solved,but here exist another problem.when I finished to train the net 5 epoch,the error "FileNotFoundError: [Errno 2] No such file or directory: '/opt/data/private/hrnet-pytorch-main/VOCdevkit/VOC2007/SegmentationClass/JPEGImages/val/20160222_080850.jpg.png'" is been presented,in the meanwhile the error also says "File "/opt/data/private/hrnet-pytorch-main/utils/utils_metrics.py", line 82, in compute_mIoU label = np.array(Image.open(gt_imgs[ind]))". So I find the utils_metrics.py and search the variable----gt_imgs.we can find it was been defined in the code----"gt_imgs = [join(gt_dir, x + ".png") for x in png_name_list]".Then I saw that the png_name_list is a Morphological parameters of the founction----compute_mIoU that was been imported in callbacks.py file and repluced by self.image_ids during the use of compute_mIoU.Shortly afterward,I located the codes "for image_id in tqdm(self.image_ids):" and "self.image_ids = [image_id.split()[0] for image_id in image_ids]" in the in callbacks.py file.However,my .txt file style is different from your,for example "JPEGImages/train/20160222_080933.jpg SegmentationClass/train/20160222_080933_mask.png" is a line .So the code "image.save(os.path.join(pred_dir,image_id + ".png"))" does not find the right path. But in situation of maintaining my .txt file I dont know how to modify the code.I think that I should redefine image_id.But I dont know how to do.

Thehonst commented 2 years ago

Why has ACC kept at 100 during the training process? And,most of the time during the training process,the loss kept at 0.501

bubbliiiing commented 2 years ago
  1. I think you should try to download a VOC dataset. I provide VOC_ Annotation.py, used to generate TXT for the division of training set and test set.
  2. This should be because your data set format is wrong. Maybe you should show me how your label is.
Thehonst commented 2 years ago

image This is my dataset format. IMG_2941_mask This is a picture of my label which had been made that its target pixel value is equal to 1. these features of my dataset are the same as your ,but the only different is the .txt files format.Such as "JPEGImages/train/20160330_170922.jpg SegmentationClass/train/20160330_170922_mask.png" is one line of content,which contains not only names of image and label, but also relative paths of them.In order to find right images or labels paths, I had modified the codes which can extract the pictures or labels names from the .txt files.I think this will fit your codes.

bubbliiiing commented 2 years ago

That's OK. Can loss converge normally?