Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file of few supervision. #22

Open
Huiimin5 opened this issue Aug 12, 2021 · 5 comments
Open

Config file of few supervision. #22

Huiimin5 opened this issue Aug 12, 2021 · 5 comments

Comments

@Huiimin5
Copy link

It is a very nice work.
Thank you so much for your contribution.
Is it possible to release scripts for few-supervision on PASCAL VOC 2012, too?

@charlesCXK
Copy link
Owner

charlesCXK commented Aug 12, 2021

Hi, the config file of few supervision is here.
(1) You could start from this config. Please note that we only show the difference in the below. Other files such as network.py, train.py need no change.
(2) Following the official code of PseudoSeg, we view all the 10582 images in the VOC Aug set as the unlabeled set. The image IDs are recorded in the file train_aug.txt. To generate this file, you could simply merge two files: train_aug_unlabeled_1-2.txt and train_aug_labeled_1-2.txt.
(3) We train 30 epochs for few supervision. The cps_weight is 0.1 here, but if you use 0.5, you would get significantly higher performance than the number in our paper (1%~4% IoU gain for 732, 366, 183 labeled settings).

C.dataset_path = osp.join(C.volna, 'DATA/pascal_voc')
C.img_root_folder = C.dataset_path
C.gt_root_folder = C.dataset_path
C.labeled_ratio = 2
C.train_source = osp.join(C.dataset_path,'subset_train_aug/pseudoseg_labeled_1-{}.txt'.format(C.labeled_ratio))
C.unsup_source = osp.join(C.dataset_path, 'train_aug.txt')
C.eval_source = osp.join(C.dataset_path, "val.txt")
C.is_test = False

C.num_train_imgs = 1464 // C.labeled_ratio
C.num_eval_imgs = 1449
C.num_unsup_imgs = 10582     # unsupervised samples

C.max_samples = max(C.num_train_imgs, C.num_unsup_imgs)


"""Train Config"""
if os.getenv('learning_rate'):
    C.lr = float(os.environ['learning_rate'])
else:
    C.lr = 0.001

if os.getenv('batch_size'):
    C.batch_size = int(os.environ['batch_size'])
else:
    C.batch_size = 8

C.nepochs = 30
C.niters_per_epoch = int(math.ceil(C.max_samples * 1.0 // C.batch_size))
C.num_workers = 8
C.train_scale_array = [0.5, 0.75, 1, 1.5, 1.75, 2.0]
C.warm_up_epoch = 0

C.cps_weight = 0.1
C.cutmix_mask_prop_range=(0.25, 0.5)
C.cutmix_boxmask_n_boxes=3
C.cutmix_boxmask_fixed_aspect_ratio=False
C.cutmix_boxmask_by_size=False
C.cutmix_boxmask_outside_bounds=False
C.cutmix_boxmask_no_invert=False

@charlesCXK charlesCXK changed the title few supervision Config file of few supervision. Aug 12, 2021
@Huiimin5
Copy link
Author

Huiimin5 commented Aug 13, 2021

Hi, Thank you so much for your reply.
But changing C.train_source to subset_train_aug/pseudoseg_labeled_1-{}.txt only leads me dataloader errors.
image
I think the problem is with file format because when I check overlap ids between subset_train_aug/pseudoseg_labeled_1-2.txt and train_aug.txt with uniq command I can only find one but there are definitely identical ids across these two files.
image

Could you find overlapped ids using uniq in your environment?

@charlesCXK
Copy link
Owner

Could you provide more details?

@Huiimin5
Copy link
Author

It seems the problem is caused by missing directory: TorchSemiSeg/DATA/pascal_voc/pseudoseg_labeled_1-2.
Could you please provide that?

@charlesCXK
Copy link
Owner

Hi, there is no need to create such a directory. All the images could be found in the VOC Aug set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants