Comments (1)
Thanks for sharing the code. It helps me understand the APN, I have been confused by how the author crops the attention region.
In the backward code of APN, I found you used a fixed value of in_size. (If my understanding for the code is right) Did you just backpropagate the gradient to a fixed location? if it is fixed, why did you do that? If not, how you backpropagate the gradient to the attention location?
Thanks in advance
def backward(self, grad_output): images, ret_tensor = self.saved_variables[0], self.saved_variables[1] in_size = 224 ret = torch.Tensor(grad_output.size(0), 3).zero_() norm = -(grad_output * grad_output).sum(dim=1) x = torch.stack([torch.arange(0, in_size)] * in_size).t() y = x.t() long_size = (in_size/3*2) short_size = (in_size/3) mx = (x >= long_size).float() - (x < short_size).float() my = (y >= long_size).float() - (y < short_size).float() ml = (((x<short_size)+(x>=long_size)+(y<short_size)+(y>=long_size)) > 0).float()*2 - 1 mx_batch = torch.stack([mx.float()] * grad_output.size(0)) my_batch = torch.stack([my.float()] * grad_output.size(0)) ml_batch = torch.stack([ml.float()] * grad_output.size(0)) if isinstance(grad_output, torch.cuda.FloatTensor): mx_batch = mx_batch.cuda() my_batch = my_batch.cuda() ml_batch = ml_batch.cuda() ret = ret.cuda() ret[:, 0] = (norm * mx_batch).sum(dim=1).sum(dim=1) ret[:, 1] = (norm * my_batch).sum(dim=1).sum(dim=1) ret[:, 2] = (norm * ml_batch).sum(dim=1).sum(dim=1) return None, ret
I have met the same problem. Have you figured this out yet?
from racnn-pytorch.
Related Issues (20)
- hi,i don't know what happened .RuntimeError: "exp" not implemented for 'torch.LongTensor' HOT 13
- TypeError: expected Tensor as element 0 in argument 0, but got list HOT 10
- save model and predict HOT 5
- Question of formula 8 HOT 5
- some question for loss HOT 2
- about apn HOT 1
- about saving the tx ty tl HOT 1
- Hello author, I would like to ask the two documents in the picture you have given in the project? I can't find these two files in the downloaded resource. HOT 2
- RuntimeError: _th_exp_out not supported on CUDAType for Long HOT 2
- RuntimeError: It is expected output_size equals to 1, but got size 2 HOT 3
- is there some bug HOT 2
- TypeError: 'module' object is not callable HOT 1
- some mistake in the code HOT 1
- Some mistake in APN HOT 5
- Use of Average Pool to Conv5_4 layers before APN? HOT 3
- RuntimeError: CUDA out of memory. HOT 2
- some question:'RACNN' object has no attribute 'module' HOT 1
- about data and what those .txt file contain HOT 3
- error find in line 75, RACNN.py when run train.py 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 racnn-pytorch.