Comments (5)
Why are the metrics multiplied by the batch size, added cumulatively and then divided by the total number of samples during printing?
It seems like this will print a scaled version of the average metric value (from print_metrics), depending on the batch size. Please correct me if I'm wrong.
from pytorch-unet.
You're right. The current code uses BCE, so each pixel can have multiple classes i.e. multi-labels.
To make it a single class for each pixel i.e. multi-class, you can use CE. I think you need to use reshape/view to 2d.
from pytorch-unet.
Hi, I am having a problem dealing with a multi-class task where dimensions are like these:
MASK TARGET: torch.Size([4, 1, 600, 900, 3])
OUTPUT: torch.Size([4, 5, 600, 900]
@ckolluru Have you created your loss function for multiclass already?
from pytorch-unet.
Why are the metrics multiplied by the batch size, added cumulatively and then divided by the total number of samples during printing?
The reason is some batches (i.e. the last batch) may have fewer training examples than all the other batches. Dividing the product metric * batch_size
by total_samples
is a better estimate of a used metric for a complete epoch. Skimming through the example Training a Classifier from PyTorch tutorials reveals that the same strategy was used in section "4. Train the network" is the important one where the statistics were printed.
It seems like this will print a scaled version of the average metric value (from print_metrics), depending on the batch size. Please correct me if I'm wrong.
That's true! You may get a better insight into this topic by reading How is the loss for an epoch reported?
from pytorch-unet.
If you want to use cross entropy make sure you're not applying sigmoid function beforehand.
from pytorch-unet.
Related Issues (17)
- License? HOT 1
- how to train on my own dataset ? HOT 1
- Use ConvTranspose2d instead HOT 2
- RuntimeError with ResNetUNet HOT 3
- Add Colab
- making label HOT 1
- Grayscale Images HOT 2
- Dice value is high at the beginning
- RGB Target mask
- CUDA out of memory HOT 2
- network output HOT 1
- Resnet Model Validity HOT 1
- Dataloader Iterator Not working on custom datataset HOT 1
- Dimensions not working HOT 5
- Image dimensions do not match HOT 2
- If input_img is a natural scene image? HOT 1
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-unet.