tusen-ai / simpledet

A Simple and Versatile Framework for Object Detection and Instance Recognition
Apache License 2.0
3.08k stars 488 forks source link

rpn_bbox_weight is missing while computing rpn l1 loss? #237

Closed hdjsjyl closed 5 years ago

hdjsjyl commented 5 years ago

The following is the official code for computing rpn l1 loss:

regression loss

    reg_loss = X.smooth_l1(
        (bbox_delta - bbox_target),
        scalar=3.0,
        name="rpn_reg_l1"
    )
    reg_loss = bbox_weight * reg_loss
    reg_loss = X.loss(
        reg_loss,
        grad_scale=1.0 / (batch_image * image_anchor) * scale_loss_shift,
        name="rpn_reg_loss"
    )

When I use the following code to draw the network structure to a pdf: a = mx.viz.plot_network(sym) a.render('net_train')

The network structure pdf version doesn't have bbox_weight, which is corresponding the position of red arrow in the following picture: rpn_bbox_weight

RogerChern commented 5 years ago

The weight is used as shown in checkpoint.json

    {
      "op": "elemwise_mul",
      "name": "_mul0",
      "inputs": [[446, 0, 0], [462, 0, 0]]
    },

The viz tool in MXNet is written 3 or 4 years ago. We recommend you try Netron for visualization.