Comments (2)
Hi @Linranran :
In the code we can see that:
open-reid/reid/utils/data/dataset.py
Lines 18 to 21 in 5db4f6b
relabel=True
makes the pids continuous from 0 to the total number of persons in the datasets(or subsets).If you change
relabel=True
to relabel=False
, the pids will be the real id according to the original datasets.
In the training progress at here:
Lines 69 to 72 in 5db4f6b
the variable
outputs
is a tensor which the size is B * C
and targets
is a tensor which the size is B
, where B
is minibatch size and C
is number of classes.C
is defined at here:open-reid/examples/softmax_loss.py
Lines 89 to 90 in 5db4f6b
and used to create the model:
open-reid/reid/models/resnet.py
Line 58 in 5db4f6b
Let's take Market1501 for example:
If relabel=True
:
outputs
is B * 751
, because the trainval dataset contains 751 persons. targets
is pids which ranges from 0 to 750.
If relabel=False
:
outputs
is B * 751
but targets
is ranging from 2 to 1500.( targets
is the real id according to the original datasets)
From the PyTorch official docs about CrossEntropyLoss
:
The input is expected to contain scores for each class.
input
has to be a 2D Tensor of size (minibatch, C).
This criterion expects a class index (0 to C-1) as the target for each value of a 1D tensor of size minibatch
So it will raise an error when you use CrossEntropyLoss
because the targets
is exceeded index (0 to C-1).
More information: http://pytorch.org/docs/master/nn.html#torch.nn.CrossEntropyLoss
from open-reid.
@zydou Thank you so much for your detailed explaination. I really appreciate it.
from open-reid.
Related Issues (20)
- Dependencies - setup.py
- is it generalised
- DukeMTMC dataset can't be downloaded HOT 2
- Problem with the file examine.softmax_loss.py HOT 5
- It can not converge on non-pretrained model HOT 1
- Train with only 1 camera in duke
- Viper is missing HOT 2
- TypeError: Can't instantiate abstract class Euclidean with abstract methods get_metric, score_pairs HOT 1
- How much video memory do I need? HOT 1
- DukeMTMC result reporting
- OIM loss HOT 1
- OIM loss initialize error
- IndexError: invalid index of a 0-dim tensor. HOT 6
- RuntimeError: zero-dimensional tensor (at position 0) cannot be concatenated
- RuntimeError: Duke
- TypeError: Can't instantiate abstract class Euclidean with abstract methods get_metric, score_pairs HOT 2
- something miss with sort and match? HOT 1
- AssertionError: Torch not compiled with CUDA enabled
- Oim Loss with 'NAN' problem
- eep q learning
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 open-reid.