Comments (11)
@sydney0zq This is the matrix for the affine transform. You may learn the relevant knowledge from image processing or computer vision courses.
@xiaoyong Actually I am a little bit confused about this 1 to 0 index from lua to torch (and from the annotation). Would you create a pull request to clarify this if it won't cost much of your time? Thank you very much!
from pytorch-pose.
from pytorch-pose.
Hi @bestlin ,
I know that python's index starts from 0 while lua index starts from 1. I don't think this is the reason. Because the index difference should considered in the data preprocessing part, i.e. generating the json files. A more important reason is that minus 1 at the resolution of 64x64 and plus 1 at the resolution of 256x256 is obviously not equivalent not matter in python or lua.
from pytorch-pose.
For transform
, please refer to the original lua code.
https://github.com/anewell/pose-hg-train/blob/master/src/util/img.lua#L54-L65
function transform(pt, center, scale, rot, res, invert)
local pt_ = torch.ones(3)
pt_[1],pt_[2] = pt[1]-1,pt[2]-1
local t = getTransform(center, scale, rot, res)
if invert then
t = torch.inverse(t)
end
local new_point = (t*pt_):sub(1,2)
return new_point:int():add(1)
end
The +1
and -1
in the following code is left here for historical reason. To compare with previously trained models, I will leave them unchanged.
tpts[i, 0:2] = to_torch(transform(tpts[i, 0:2]+1, c, s, [self.out_res, self.out_res], rot=r))
target[i] = draw_labelmap(target[i], tpts[i]-1, self.sigma, type=self.label_type)
from pytorch-pose.
@bearpaw ,Thanks! I was reading the file in repo pose-hg-demo:
https://github.com/anewell/pose-hg-demo/blob/master/img.lua
function transform(pt, center, scale, rot, res, invert)
-- For managing coordinate transformations between the original image space
-- and the heatmap
local pt_ = torch.ones(3)
pt_[1] = pt[1]
pt_[2] = pt[2]
local t = getTransform(center, scale, rot, res)
if invert then
t = torch.inverse(t)
end
local new_point = (t*pt_):sub(1,2):int()
return new_point
end
Do you know why doesn't this transform function have the +1 and -1? Thanks!
from pytorch-pose.
@zhiqiangdon It seems that there are some mismatches between pose-hg-demo
and pose-hg-train
. I think pose-hg-train
is relatively up-to-date.
I do not quite know the reason. But I guess it might due to the int
operation. The trick might improve the computational accuracy (float and int stuff) and the performance a little bit. But it's absolutely not a key point, and I've never verified this either.
from pytorch-pose.
@bearpaw Thanks!
from pytorch-pose.
I have some questions about transform.py
, can anyone help me out?
def get_transform(center, scale, res, rot=0):
# General image processing matrix
h = 200 * scale # what does 200 means?
t = np.zeros((3, 3)) # this is transform matrix, what is our aim? Any mathematical formula?
t[0, 0] = float(res[1]) / h
t[1, 1] = float(res[0]) / h
t[0, 2] = res[1] * (-float(center[0]) / h + .5)
t[1, 2] = res[0] * (-float(center[1]) / h + .5)
t[2, 2] = 1
Thanks, I just get stuck on them.
from pytorch-pose.
Affine transform should be performed on 0-indexed points. So it's totally fine to remove the +1/-1 in transform
and use consistent (0-indexed) coordinates.
@bearpaw There might exist an inconsistency in
pytorch-pose/pose/utils/transforms.py
Lines 132 to 134 in ad2309e
where 0-indexed points are fed to
transform
but it expects 1-indexed points.from pytorch-pose.
@bearpaw Sure, I converted 1 to 0 index and everything works well, both on your pretrained model and my own retrained model. But I need to do some code tidy up. Maybe after the forthcoming holiday :-)
from pytorch-pose.
Hi @xiaoyong ,
Can you show where in codes you omit +1
and -1
approach, and no results are changed
there are done because of converting float
numbers to int
somewhere
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.