Git Product home page Git Product logo

Comments (5)

pengsida avatar pengsida commented on September 26, 2024

The number of classes in sbd_snake.yaml is set to 20 https://github.com/zju3dv/snake/blob/master/configs/sbd_snake.yaml#L20, while the class number is set to 80 in Coco dataset https://github.com/zju3dv/snake/blob/master/lib/datasets/coco/snake.py#L151

from snake.

RonDen avatar RonDen commented on September 26, 2024

Got it! Thank you!

from snake.

RonDen avatar RonDen commented on September 26, 2024

Maybe there should be a variable num_class to control this.

from snake.

pengsida avatar pengsida commented on September 26, 2024

It is a good advice.
I have updated the code.

from snake.

RonDen avatar RonDen commented on September 26, 2024

I constantly get this error in almost every 4-5 epoch training.

Traceback (most recent call last):
  File "train_net.py", line 57, in <module>
    main()
  File "train_net.py", line 53, in main
    train(cfg, network)
  File "train_net.py", line 35, in train
    trainer.val(epoch, val_loader, evaluator, recorder)
  File "/ldap_shared/home/s_zyt/inseg/code/snake/lib/train/trainers/trainer.py", line 76, in val
    for batch in tqdm.tqdm(data_loader):
  File "/ldap_shared/home/s_zyt/.pyenv/versions/anaconda3-2019.07/envs/snake/lib/python3.7/site-packages/tqdm/_tqdm.py", line 979, in __iter__
    for obj in iterable:
  File "/ldap_shared/home/s_zyt/.pyenv/versions/anaconda3-2019.07/envs/snake/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 346, in __next__
    data = self.dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/ldap_shared/home/s_zyt/.pyenv/versions/anaconda3-2019.07/envs/snake/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "/ldap_shared/home/s_zyt/inseg/code/snake/lib/datasets/collate_batch.py", line 7, in snake_collator
    ret = {'inp': default_collate([b['inp'] for b in batch])}
  File "/ldap_shared/home/s_zyt/.pyenv/versions/anaconda3-2019.07/envs/snake/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 65, in default_collate
    return default_collate([torch.as_tensor(b) for b in batch])
  File "/ldap_shared/home/s_zyt/.pyenv/versions/anaconda3-2019.07/envs/snake/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 56, in default_collate
    return torch.stack(batch, 0, out=out)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 544 and 480 in dimension 2 at /pytorch/aten/src/TH/generic/THTensor.cpp:689

Should the validation dataloader worker number be set as 0?
Previously, I got this error in train dataloader, so I set the num_worker=0, it works.

Configuration as follow:

train:
    optim: 'adam'
    lr: 1e-4
    milestones: (80, 120, 150, 170)
    gamma: 0.5
    batch_size: 16
    dataset: 'CocoTrain'
    num_workers: 0
    epoch: 150
test:
    # dataset: 'SbdMini'
    dataset: 'CocoVal'
    batch_size: 16
    num_workers: 0

My operating system is Ubuntu16.04.
Thank you!

from snake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.