kaixin96 / PANet

Code for our ICCV 2019 paper PANet: Few-Shot Image Semantic Segmentation with Prototype Alignment
315 stars 64 forks source link

Key error #12

Closed gaowq2017 closed 4 years ago

gaowq2017 commented 4 years ago

image

kaixin96 commented 4 years ago

Hi @hellolaogao, can you give more details about the error?

_config is a dictionary automatically passed in by sacred. Values in _config are defined in config.py and can be modified by command line args. Anyway, it should contain key optim.

Thank you.

gaowq2017 commented 4 years ago

Hi @kaixin96, Thank you very much! I'm interested in your research. I have found the problem! Thank you! Best regard!

2679622694 commented 3 years ago

嗨@kaixin96,非常感谢!我对你的研究很感兴趣。我发现了问题! 谢谢!最良好的问候!

Hello, how did you solve this problem?

liutongkun commented 1 year ago

You can modify the 'mode' in line 30, config.py from 'test' to 'train'

fewshotstudy commented 6 months ago

Hi @kaixin96, Thank you very much! I'm interested in your research. I have found the problem! Thank you! Best regard!

hello sir, how did you solute the "keyerro:optim"? can you share some details? thank you,!

fewshotstudy commented 6 months ago

You can modify the 'mode' in line 30, config.py from 'test' to 'train' hello,sir. I try this method to solute "keyerro:optim", but it cannot work. so didi you solute this bug?

liutongkun commented 6 months ago

You can modify the 'mode' in line 30, config.py from 'test' to 'train' hello,sir. I try this method to solute "keyerro:optim", but it cannot work. so didi you solute this bug?

Yes I did. You just need to check if there is the ‘optim’ key in your config.py

    if mode == 'train':
        dataset = 'VOC'  # 'VOC' or 'COCO'
        n_steps = 30000
        label_sets = 0
        batch_size = 1
        lr_milestones = [10000, 20000, 30000]
        align_loss_scaler = 1
        ignore_label = 255
        print_interval = 100
        save_pred_every = 10000

        model = {
            'align': True,
        }

        task = {
            'n_ways': 1,
            'n_shots': 1,
            'n_queries': 1,
        }

        optim = {
            'lr': 1e-3,
            'momentum': 0.9,
            'weight_decay': 0.0005,
        }

As you can see, for the original code, the 'optim' only exists in 'train' mode

fewshotstudy commented 6 months ago

You can modify the 'mode' in line 30, config.py from 'test' to 'train' hello,sir. I try this method to solute "keyerro:optim", but it cannot work. so didi you solute this bug?

Yes I did. You just need to check if there is the ‘optim’ key in your config.py

    if mode == 'train':
        dataset = 'VOC'  # 'VOC' or 'COCO'
        n_steps = 30000
        label_sets = 0
        batch_size = 1
        lr_milestones = [10000, 20000, 30000]
        align_loss_scaler = 1
        ignore_label = 255
        print_interval = 100
        save_pred_every = 10000

        model = {
            'align': True,
        }

        task = {
            'n_ways': 1,
            'n_shots': 1,
            'n_queries': 1,
        }

        optim = {
            'lr': 1e-3,
            'momentum': 0.9,
            'weight_decay': 0.0005,
        }

As you can see, for the original code, the 'optim' only exists in 'train' mode

thank you sir! i make it.
a new bug : if lr is not required and lr < 0.0: TypeError: '<' not supported between instances of 'dict' and 'float' maybe the type of lr is wrong, if you have seen this bug, it is my pleasure to get your idea Anyway thx, best regard!

liutongkun commented 6 months ago

You can modify the 'mode' in line 30, config.py from 'test' to 'train' hello,sir. I try this method to solute "keyerro:optim", but it cannot work. so didi you solute this bug?

Yes I did. You just need to check if there is the ‘optim’ key in your config.py

    if mode == 'train':
        dataset = 'VOC'  # 'VOC' or 'COCO'
        n_steps = 30000
        label_sets = 0
        batch_size = 1
        lr_milestones = [10000, 20000, 30000]
        align_loss_scaler = 1
        ignore_label = 255
        print_interval = 100
        save_pred_every = 10000

        model = {
            'align': True,
        }

        task = {
            'n_ways': 1,
            'n_shots': 1,
            'n_queries': 1,
        }

        optim = {
            'lr': 1e-3,
            'momentum': 0.9,
            'weight_decay': 0.0005,
        }

As you can see, for the original code, the 'optim' only exists in 'train' mode

thank you sir! i make it. a new bug : if lr is not required and lr < 0.0: TypeError: '<' not supported between instances of 'dict' and 'float' maybe the type of lr is wrong, if you have seen this bug, it is my pleasure to get your idea Anyway thx, best regard!

You may need to check the type of your variable. I guess lr here is not a float, but a dictionary, maybe it should be written like

 if _config['optim']['lr']<0.0
fewshotstudy commented 6 months ago

You can modify the 'mode' in line 30, config.py from 'test' to 'train' hello,sir. I try this method to solute "keyerro:optim", but it cannot work. so didi you solute this bug?

Yes I did. You just need to check if there is the ‘optim’ key in your config.py

    if mode == 'train':
        dataset = 'VOC'  # 'VOC' or 'COCO'
        n_steps = 30000
        label_sets = 0
        batch_size = 1
        lr_milestones = [10000, 20000, 30000]
        align_loss_scaler = 1
        ignore_label = 255
        print_interval = 100
        save_pred_every = 10000

        model = {
            'align': True,
        }

        task = {
            'n_ways': 1,
            'n_shots': 1,
            'n_queries': 1,
        }

        optim = {
            'lr': 1e-3,
            'momentum': 0.9,
            'weight_decay': 0.0005,
        }

As you can see, for the original code, the 'optim' only exists in 'train' mode

thank you sir! i make it. a new bug : if lr is not required and lr < 0.0: TypeError: '<' not supported between instances of 'dict' and 'float' maybe the type of lr is wrong, if you have seen this bug, it is my pleasure to get your idea Anyway thx, best regard!

You may need to check the type of your variable. I guess lr here is not a float, but a dictionary, maybe it should be written like

 if _config['optim']['lr']<0.0

Thank you, I resolve it! what a nice day!

fewshotstudy commented 6 months ago

You can modify the 'mode' in line 30, config.py from 'test' to 'train' hello,sir. I try this method to solute "keyerro:optim", but it cannot work. so didi you solute this bug?

Yes I did. You just need to check if there is the ‘optim’ key in your config.py

    if mode == 'train':
        dataset = 'VOC'  # 'VOC' or 'COCO'
        n_steps = 30000
        label_sets = 0
        batch_size = 1
        lr_milestones = [10000, 20000, 30000]
        align_loss_scaler = 1
        ignore_label = 255
        print_interval = 100
        save_pred_every = 10000

        model = {
            'align': True,
        }

        task = {
            'n_ways': 1,
            'n_shots': 1,
            'n_queries': 1,
        }

        optim = {
            'lr': 1e-3,
            'momentum': 0.9,
            'weight_decay': 0.0005,
        }

As you can see, for the original code, the 'optim' only exists in 'train' mode

thank you sir! i make it. a new bug : if lr is not required and lr < 0.0: TypeError: '<' not supported between instances of 'dict' and 'float' maybe the type of lr is wrong, if you have seen this bug, it is my pleasure to get your idea Anyway thx, best regard!

You may need to check the type of your variable. I guess lr here is not a float, but a dictionary, maybe it should be written like


 if _config['optim']['lr']<0.0
Hello sir. I run test.py. I check the "runs" file, but i cannot find the visual results...
where do i see the visual results?