Comments (10)
change to this
def dist_acc(dists, thr=0.5):
''' Return percentage below threshold while ignoring values with a -1 '''
if dists.ne(-1).sum() > 0:
return float(dists.le(thr).eq(dists.ne(-1)).sum()) / float(dists.ne(-1).sum())
else:
return -1
from pytorch-pose.
Alright, it's really problem caused by pytorch version. In pytorch 0.4, for example, torch.tensor(3) / torch.tensor(4) equals tensor(0), even if the source code multiply a 1.0 to make it float, so I only get tensor(0) or tensor(1) out of it. This occurs in the dist_acc() function in evaluation.py. This explains why my testing result gets worse when batch size is large, it has to be all of them lower than threshold will be tensor(1). But is it caused by pytorch version is unknown, I haven't tested it on another version.
from pytorch-pose.
@Bob130 try this, I solved my problem by this.
def dist_acc(dists, thr=0.5):
''' Return percentage below threshold while ignoring values with a -1 '''
if dists.ne(-1).sum() > 0:
return dists.le(thr).eq(dists.ne(-1)).sum().float() / dists.ne(-1).sum().float()
else:
return -1
from pytorch-pose.
@bearpaw why is the performance of the same model and code with different test-batch size varies quite much, smaller the batch size on testing, better the performance. 80% with 2 data per batch and only 50% with 6 data per batch. I think it's the reason why I can't get good training performance.
from pytorch-pose.
Hello, I have also encountered your problem, I want to know specifically in the dist_acc() function in evaluation.py. How to change, thank you for your answer, thank you
from pytorch-pose.
You can modify function dist_acc(dists, thr=0.5)
of the evaluation.py in pose.utils folder, the original code multiplies 1.0 to convert an integer tensor to float tensor, but it doesn't work in pytorch 0.4, that's why the trainIng accuracy is so low, it has to be all correct to get a 1, otherwise you'll get 0 acc.
To solve this, I just change the *1.0 to .float().
from pytorch-pose.
Thank you for your answer. It is very helpful to me. Thank you very much for your help.
from pytorch-pose.
Hi, @djangogo
I have changed the code according to your advice. However, the test acc still varies in different test batchsize.
For example,
test batchsize acc
1 0.8743
6 0.8660
16 0.8685
from pytorch-pose.
@gdjmck , thank you for your advice.
I use Python 2.7, it doesn't support using int.float() to transform int into float.
I debugged the code, and I found that both of the original and @djangogo 's code could return a float value.
But the validation acc still varies in different test batch size.
from pytorch-pose.
@Bob130 Did you track the acc values along the functions called in the evaluation.py?
When it comes to problems like this, it seems there is something wrong in the evaluation module.
from pytorch-pose.
Related Issues (20)
- Question about detections_our_format.mat HOT 1
- 关于MPII训练精度问题 HOT 3
- Some problems about the running process HOT 2
- Looking hg-s2-b1
- Is there any code about Multi-scale test in this implement?
- great idea to put together these models for pose estimation HOT 1
- When I try to train with lsp,I faced some problem HOT 2
- Whats the difference between the hourglass_gn & hourglass models? HOT 1
- How to train with your own data set
- coco_annotations_2014.json HOT 1
- Bug in crop method HOT 11
- “scale” message HOT 2
- Hello, I encountered the following problems when I was training the code. What is the reason? Python: 2.7, Pytorch: 0.4.1 HOT 1
- I cannot train! HOT 1
- How do you implement a model based on a certain epoch that you have already trained and then continue to train
- There are some training issues here
- `RuntimeError` in `HourglassNet` because of possibly incorrect `scale_factor` for `F.interpolate` HOT 2
- I had train using mscoco and lsp dataset,but I don't know how to eval the pck and mAP?could you give me some suggestions?Thanks HOT 1
- Does the appended output from the show_sample method look as intended?
- Question about calculating PCK in Python
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-pose.