xingyizhou / CenterTrack

Simultaneous object detection and tracking using center points.
MIT License
2.37k stars 525 forks source link

Pose tracking with Resnet #45

Open alxh87 opened 4 years ago

alxh87 commented 4 years ago

I'm trying to test out pose tracking using Resnet (to try implementing without DCN layer), but running into some trouble.

I am running demo.py with args tracking,multi_pose --pre_hm --arch res_18 --load_model ../models/coco_pose_tracking.pth --demo filename, and trying to create the PoseResNet model from model.py to check the structure.

This hits the following error:

File "C:\Work\Projects\CenterTrack\src\lib\model\model.py", line 28, in create_model
    model = model_class(num_layers, heads=head, head_convs=head_conv, opt=opt)
TypeError: __init__() got an unexpected keyword argument 'opt'

This seems to occur because PoseResNet(nn.Module): __init__(self, num_layers, heads, head_convs, _): doesn't expect opt, while also expecting a different positional argument. I tried a few different things to get past this, eventually changing the _ to opt in init(...), and commenting out the first super(...), which seems to create a model (probably incorrect).

But even after this, model.forward raises NotImplementedError, because there is no function to run the model. DLA34 seems to inherit this function from BaseModel, while GenericNetwork has its own implementation. Neither work with PoseResNet (BaseModel needs imgpre2feats(..), GenericNetwork needs self.backbone etc)

Should PoseResNet be changed to build from BaseModel or GenericNetwork, or simply with some different arguments? Any help to get this working is appreciated, thank you.

xingyizhou commented 4 years ago

Thank you for your experiments. The short answer is either BaseModel or GenericNetwork will work. By using GenericNetwork, you don't need to implement the upsample layers (from stride 32 to stride 4), but just using one from neck. By using BaseModel, you will need to define the upsample layers yourself. I would say inherent from GenericNetwork will be easier. See the MobileNet file for an example.