Git Product home page Git Product logo

faster-rcnn's People

Contributors

oymiss avatar

Stargazers

 avatar

Watchers

 avatar  avatar

faster-rcnn's Issues

Questions about the regression of delta

Hi, thanks for useful work. I'm not sure about the calculation of the delta regression.
In the rcnn_loss_layer function, I think the shape of delta is (p, c, 4) and p is the sum of all proposals in all batches.
For the i-th batch, find the index of a particular class, then accesses delta using the index

def rcnn_loss_layer(score, delta, label_list, fg_delta_list, index_list):
# score (p, c)
# delta (p, c, 4)
# label_list list(n, l) sum(l) == k
# fg_delta_list list(n, l1, 4)
# index_list List[Tuple[Tensor, Tensor]]
# return loss()
p, num_class = score.shape[:2]
reg_loss, cls_loss = torch.tensor(0.), torch.tensor(0.)
n = len(index_list)
# labels = torch.cat(label_list)
for i in range(n):
label = label_list[i]
fg_i, bg_i = index_list[i]
index = torch.cat((fg_i, bg_i))
# (k,)
cls_loss += F.cross_entropy(score[index], label)
# (l1, 4)
fg_delta_i = fg_delta_list[i]
for j in range(1, num_class + 1):
index_j = torch.where(label == j)
x = fg_i[index_j]
if x.shape[0] == 0:
continue
pred_delta_j = delta[x, j]
gt_delta_j = fg_delta_i[index_j]
if pred_delta_j.shape[0] > 0:
reg_loss += loss_tools.smooth_l1_loss(pred_delta_j, gt_delta_j)
return reg_loss + cls_loss

x = fg_i[index_j]
pred_delta_j = delta[x, j]

But I think the index of x here is to indicate the corresponding proposals in the batch of i.
In other words, since delta has a length of P that concatenates all the batches, it does not access the batch number i using x. I think I need to stagger the idx to account for batches to access the correct delta, but what about that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.