Skip to content

Commit ebb6f34

Browse files
committed
add model auto download
1 parent ef90e7f commit ebb6f34

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ppdiffusers/examples/controlnet/annotator/ppdet_hrnet/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
16-
1715
import cv2
1816
import numpy as np
1917
import paddle

ppdiffusers/examples/controlnet/annotator/ppdet_hrnet/det_keypoint_unite_infer.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import paddle
2222
import yaml
2323

24+
from paddlenlp.utils.downloader import get_path_from_url_with_filelock
25+
2426
from .det_keypoint_unite_utils import argsparser
2527
from .infer import ( # noqa F401
2628
Detector,
@@ -312,6 +314,15 @@ def exponential_smoothing(self, x_cur, x_pre, index=0):
312314
enable_mkldnn = False
313315
det_threshold = 0.4
314316

317+
if not os.path.exists(det_model_dir):
318+
detmodel_url = (
319+
"https://bj.bcebos.com/v1/paddledet/models/keypoint/tinypose_enhance/picodet_s_320_lcnet_pedestrian.zip"
320+
)
321+
get_path_from_url_with_filelock(detmodel_url, root_dir="annotator/ppdet_hrnet/models/")
322+
if not os.path.exists(keypoint_model_dir):
323+
kptmodel_url = "https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip"
324+
get_path_from_url_with_filelock(kptmodel_url, root_dir="annotator/ppdet_hrnet/models/")
325+
315326

316327
class PPDetPose(object):
317328
def __init__(self) -> None:

0 commit comments

Comments
 (0)