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

Loss not decreasing when training outside of script #59

Closed
plehman2000 opened this issue Mar 24, 2023 · 5 comments
Closed

Loss not decreasing when training outside of script #59

plehman2000 opened this issue Mar 24, 2023 · 5 comments

Comments

@plehman2000
Copy link

After running
python -m segm.scripts.prepare_ade20k $DATASET
python -m segm.train --log-dir seg_tiny_mask --dataset ade20k \ --backbone vit_tiny_patch16_384 --decoder mask_transformer

The training script runs without error, but the loss is not decreasing:
image

Upon further examination, when I isolated your segmenter class, I found that the parameters after the decoders transformer step do not seem to be updating.

See my note in the comment below for clarification. Any help is appreciated! I've been stuck for quite a while on this

(from decoder.py, MaskTransformer())
image

@plehman2000 plehman2000 changed the title Loss not decreasing when training Loss not decreasing when training outside of script Mar 24, 2023
@plehman2000
Copy link
Author

For clarification, I see that the average loss is decreasing, but is there any reason that making a minimum working example like this would not yield a changing loss?

MWE

image
image

Results

Unedited model

image

Returning tensor immediately after self.decoder_norm() step as the model output yields an updating loss

image

Are there any special considerations to be made when training this model outside of the training script?

@aliwagdy2580
Copy link

How did you fix the code ?

@sym330
Copy link

sym330 commented Apr 26, 2023

I put my own data set into the ade20k folder and used "python -m segm.train --log-dir seg_tiny_mask --dataset ade20k
--backbone vit_tiny_patch16_384 --decoder mask_transformer" for training. I set data.ade20k.py as follow , to detection oil.

class ADE20KSegmentation(BaseMMSeg):
    def __init__(self, image_size, crop_size, split, **kwargs):
        super().__init__(
            image_size,
            crop_size,
            split,
            ADE20K_CONFIG_PATH,
            **kwargs,
        )
        self.names, self.colors = utils.dataset_cat_description(ADE20K_CATS_PATH)
        self.n_cls = 2
        self.ignore_label = 255
        self.reduce_zero_label =False

How is the.yml file set up in data?My data set has only one class of objects and backgrounds.
I set it as follows:

  • color:
    • 127
    • 0
    • 0
      id: 0
      isthing: 0
      name: oil
  • color:
    • 0
    • 0
    • 0
      id: 1
      isthing: 0
      name: background
      But my losses keep going down but my mIOU stays the same. This question has been bothering me for a long time. Looking forward to your reply.

@rstrudel
Copy link
Owner

rstrudel commented Apr 26, 2023

@plehman2000 did you try with the linear head?
If you still have issues, please take a look at #61 .
tldr: mmsegmentation is actively maintained and you can reach similar performances as this repository with Segmenter.

@gg22mm
Copy link

gg22mm commented Oct 10, 2023

我也遇到这样的问题: #68

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

5 participants