-
Notifications
You must be signed in to change notification settings - Fork 7
Refactor model configuration with a model registry #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add configs and model registry
… instead of model_path
…itialization to accept arguments.
…istry using get_model, replacing the previous model_path approach.
…e, and update saved_model_path for consistency with model registry usage.
…pe for model registry integration, and comment out model_path for clarity.
…ered model registry, enhancing integration with the model registry.
…_model_path for consistency with the new model registry structure.
…ing for checkpoints, including model and script files, improving data management during training.
… file reference for improved clarity and consistency.
01eab70 to
80b2420
Compare
deruyter92
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your changes look good to me!
A few remarks:
- please take a look at the configs to see if the defaults are correct
- are you happy with the model names? In case you want to change them (e.g. "fmpose3d" -> "fmpose3d_human"), now is still a good time, but later this will cause difficulties. All up to you what you think is best of course.
- Are the demo predictions for the animal model tracked on GitHub on purpose? If not, maybe better to delete them.
| return x | ||
|
|
||
| class Model(nn.Module): | ||
| @register_model("fmpose3d_animals") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you happy with the names "fmpose3d" for humans and "fmpose3d_animals" for animals? Or do you want to change "fmpose3d" -> "fmpose3d_humans" or something similar?
This would be a good moment to choose the final names, before these names will be used in other code as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will change the name of the human model to 'fmpose3d_humans'
| _FMPOSE3D_DEFAULTS: Dict[str, Dict] = { | ||
| "fmpose3d": { | ||
| "n_joints": 17, | ||
| "out_joints": 17, | ||
| "dataset": "h36m", | ||
| "sample_steps": 3, | ||
| "joints_left": [4, 5, 6, 11, 12, 13], | ||
| "joints_right": [1, 2, 3, 14, 15, 16], | ||
| "root_joint": 0, | ||
| }, | ||
| "fmpose3d_animals": { | ||
| "n_joints": 26, | ||
| "out_joints": 26, | ||
| "dataset": "animal3d", | ||
| "sample_steps": 3, | ||
| "joints_left": [0, 3, 5, 8, 10, 12, 14, 16, 20, 22], | ||
| "joints_right": [1, 4, 6, 9, 11, 13, 15, 17, 21, 23], | ||
| "root_joint": 7, | ||
| }, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xiu-cs, please check if these default config values are correct and complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated this; it looks great overall.
| n_joints: int = INFER_FROM_MODEL_TYPE # type: ignore[assignment] | ||
| out_joints: int = INFER_FROM_MODEL_TYPE # type: ignore[assignment] | ||
| joints_left: List[int] = INFER_FROM_MODEL_TYPE # type: ignore[assignment] | ||
| joints_right: List[int] = INFER_FROM_MODEL_TYPE # type: ignore[assignment] | ||
| root_joint: int = INFER_FROM_MODEL_TYPE # type: ignore[assignment] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is added now, so you can load an FMPose3DConfig from model_type with the appropriate number of joints etc:
model_cfg = FMPose3DConfig(model_type="fmpose3d_animal')
… files for consistency in the FMPose3D framework.
…onsistency across the FMPose3D framework.
This pull request updates the model loading and configuration system for FMPose3D and Animal3D workflows, moving from direct file path imports to a model registry approach. This makes it easier to specify models by name, improves reproducibility, and standardizes script arguments. It also updates pretrained model references and cleans up related scripts.
Model loading and registry improvements:
get_modeland--model_typefor both human and animal 3D pose estimation; updated code inmain_animal3d.py,vis_animals.py, andFMPose3D_main.pyto use this registry. [1] [2] [3]Model) with the registry via@register_model("fmpose3d_animals")and made it inherit fromBaseModel.--model_type(defaulting tofmpose3d_animals) and clarified the use of--model_pathas an override.Script and configuration updates:
train_animal3d.sh,test_animal3d.sh,vis_animals.sh,FMPose3D_train.sh,FMPose3D_test.sh) to use--model_typeinstead of--model_path, and set new default paths for pretrained weights. [1] [2] [3] [4] [5] [6] [7] [8] [9]Minor improvements and cleanup: