简体   繁体   中英

Override constants within a python package

I am using this python package for a personal project: https://openpifpaf.github.io/intro.html I have installed it with pip install openpifpaf. I am trying to train a new model with openpifpaf.train command, but I need different constant values that are specified within this file inside the package: https://github.com/vita-epfl/openpifpaf/blob/main/src/openpifpaf/plugins/wholebody/constants.py

Any way I can override these values, short of pulling the repo and modifying the file there?

Btw, changing the constants is the way the documentation recommends for training. Wish it was properly parameterized.

If I can't find a way to do this, I will probably just pull the repo and change the source.

If you want to change the value of SCALE_FACE from 1.05 to 2 in the file you linked, you can do so in the following way:

import openpifpaf
openpifpaf.plugins.wholebody.constants.SCALE_FACE = 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM