Comments (14)
Hi,
I've never encountered this problem, are you using torch 1.1.0 ? did you see if the script works in a new env ? I think there is some problem with the packages.
from pytorch-segmentation.
Hi, I think the problem lies in the data type of the labels, can you check the type of your labels, there must be some error when loading the labels, can you post the code you use for loading them.
from pytorch-segmentation.
Hello, I'm using voc data. When I tested on ubuntu, it worked fine, but when I tested on Windows, I had the above problem.I was wondering if you've ever tested Windows?
from pytorch-segmentation.
No not in windows unfortunately, maybe the numpy version is not the correct one (or torch), sadly I am not seeing the cause of the error, try loading some labels manually in a python shell / jupyter using the code in voc.py
and base_dataset.py
and see if you can find the root cause.
from pytorch-segmentation.
You need to create your dataloader, like the ones provided in dataloaders/
, you'll need to implement two function _set_files
: sets the file paths for the labels and the images, and _load_data
loads the labels and images given an index.
And then create a loader and with the correct parameters (num classes = 2 for instance) and then change the config file and you're done.
from pytorch-segmentation.
Thank you, I have implemented it, however, I have a problem with the program when I replace Crossentropy with DiceLoss.
Traceback (most recent call last):
File "C:/Users/lenovo/PycharmProjects/fr/pytorch_segmentation-master/train.py", line 61, in
main(config, args.resume)
File "C:/Users/lenovo/PycharmProjects/fr/pytorch_segmentation-master/train.py", line 30, in main
loss = getattr(losses, config['loss'])(ignore_index = config['ignore_index'])
TypeError: init() got an unexpected keyword argument 'ignore_index'
By the way, my numclass is 2, do I need to modify the following function?
palette.py
def get_voc_palette(num_classes):
n = num_classes
palette = [0](n3)
for j in range(0,n):
lab = j
palette[j3+0] = 0
palette[j3+1] = 0
palette[j3+2] = 0
i = 0
while (lab > 0):
palette[j3+0] |= (((lab >> 0) & 1) << (7-i))
palette[j3+1] |= (((lab >> 1) & 1) << (7-i))
palette[j3+2] |= (((lab >> 2) & 1) << (7-i))
i = i + 1
lab >>= 3
return palette
from pytorch-segmentation.
Just remove the ignore_index
, given that dice loss in utils\losses.py
doesn't take as input argument ignore_index
, for the function creating the palette, you don't need to change it, unless you already have a specific palette you want to use
from pytorch-segmentation.
when I remove the ignore_index, I have another problem
Traceback (most recent call last):
File "C:/Users/lenovo/PycharmProjects/fr/pytorch_segmentation-master/train.py", line 61, in
main(config, args.resume)
File "C:/Users/lenovo/PycharmProjects/fr/pytorch_segmentation-master/train.py", line 40, in main
train_logger=train_logger)
File "C:\Users\lenovo\PycharmProjects\fr\pytorch_segmentation-master\trainer.py", line 14, in init
super(Trainer, self).init(model, loss, resume, config, train_loader, val_loader, train_logger)
File "C:\Users\lenovo\PycharmProjects\fr\pytorch_segmentation-master\base\base_trainer.py", line 35, in init
self.loss.to(self.device)
File "C:\Users\lenovo\AppData\Local\conda\conda\envs\fr\lib\site-packages\torch\nn\modules\module.py", line 386, in to
return self._apply(convert)
AttributeError: 'torch.device' object has no attribute '_apply'
from pytorch-segmentation.
I just took a look, there is indeed a problem with the loss when the ignore index is say 255, the one hot target is of different size than the output, which triggers a device error.
Just pushed a simple correction, might need to fix it for good with gradient stopping, but for now it works, this time don't remove ignore index.
from pytorch-segmentation.
Did you create you own dataloader, with the correct paths (for example for VOC, the images are in VOCdevkit/VOC2012/JPEGImages
and the labels in VOCdevkit/VOC2012/SegmentationClass
) you need to adjust the variables for you dataset.
from pytorch-segmentation.
For the number of classes, there is a class attribute in class VOCDataset
called self.num_classes
, set it to 2, other that that you're good to go (you might also want to calculate the mean
and std
of your dataset, but you can do it afterwards)
from pytorch-segmentation.
OK,Thanks.
from pytorch-segmentation.
Hello, recently I meet the same problem like yours.My research is extremely same as your research.I use the same model ,the same loss function,And it's also a two class segmentation.My problem is the same as yours.Even if the losses keep going down,but the Pixel_acc and mean_Iou didn't change from 5th epoch to 50th epoch.The evaluation didn't change too much.I don't know why.Could you tell is this a bug of code or I do something wrong ?
Waiting for your reply.Thank you!
from pytorch-segmentation.
Hello, I just saw it recently. Have you solved this problem?
from pytorch-segmentation.
Related Issues (20)
- resume training problem HOT 1
- How to use the pretrained model to output one class HOT 1
- Using Unet for training in Freiburg Forest dataset HOT 1
- LOSS is shown as Nan. HOT 2
- Binary segmentation on a custom dataset HOT 1
- How to set the "weight" for CrossEntropyLoss2d in config file? HOT 1
- RuntimeError: cuda runtime error (11) : invalid argument at /pytorch/aten/src/THC/THCGeneral.cpp:383 HOT 1
- Resnet model URLs inaccessible HOT 1
- I have some environment problem.
- what is ADE20K configfile ? HOT 1
- hi,can you tell me if I want to train segnet,should I download vgg or other backbone?
- Test evaluation with custom Dataset HOT 1
- UNet decoder layers double conv might have logical errors HOT 1
- Issues with JSON parser in the train.py file.
- How to activate GPU training? HOT 2
- No Output on cityscape dataset
- URL broken for ResNet50, 101, 152 HOT 1
- RailSem19 Dataset
- FCN model can't restore the image to its original resolution
- Deeplab V3+ model doesn't support ResNet-50 as backbone?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-segmentation.