This reverts commit 8c634ce4b0
.
This commit is contained in:
parent
993d503a28
commit
4b66fbfe21
@ -9,7 +9,6 @@ import sys
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
src_url = "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task"
|
|
||||||
path_to_model_dir = os.path.join(sys.argv[1], "downloads")
|
path_to_model_dir = os.path.join(sys.argv[1], "downloads")
|
||||||
tflite_file_name = 'pose_detector.tflite'
|
tflite_file_name = 'pose_detector.tflite'
|
||||||
tflite_model_path = os.path.join(path_to_model_dir, tflite_file_name)
|
tflite_model_path = os.path.join(path_to_model_dir, tflite_file_name)
|
||||||
@ -19,11 +18,7 @@ if not os.path.exists(path_to_model_dir):
|
|||||||
os.makedirs(path_to_model_dir, exist_ok=True)
|
os.makedirs(path_to_model_dir, exist_ok=True)
|
||||||
if not os.path.exists(tflite_model_path):
|
if not os.path.exists(tflite_model_path):
|
||||||
if not os.path.exists(task_file_path):
|
if not os.path.exists(task_file_path):
|
||||||
try:
|
urllib.request.urlretrieve("https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task", task_file_path)
|
||||||
urllib.request.urlretrieve(src_url, task_file_path)
|
|
||||||
except:
|
|
||||||
print(f"ERROR: Cannot download model archive, try to download it manually from {src_url} and place to {task_file_path}")
|
|
||||||
exit(2)
|
|
||||||
with zipfile.ZipFile(task_file_path, "r") as f:
|
with zipfile.ZipFile(task_file_path, "r") as f:
|
||||||
f.extract(tflite_file_name, path_to_model_dir)
|
f.extract(tflite_file_name, path_to_model_dir)
|
||||||
|
|
||||||
|
@ -14,11 +14,7 @@ out_folder = sys.argv[2]
|
|||||||
mark_file = sys.argv[3]
|
mark_file = sys.argv[3]
|
||||||
|
|
||||||
assert gen_script.endswith('.py'), "Unexpected script: " + gen_script
|
assert gen_script.endswith('.py'), "Unexpected script: " + gen_script
|
||||||
try:
|
subprocess.run([sys.executable, gen_script, out_folder], env=os.environ)
|
||||||
subprocess.run([sys.executable, gen_script, out_folder], env=os.environ, check=True)
|
|
||||||
except subprocess.CalledProcessError as cpe:
|
|
||||||
if cpe.returncode == 2:
|
|
||||||
exit(2)
|
|
||||||
|
|
||||||
# Create mark file indicating that script was executed
|
# Create mark file indicating that script was executed
|
||||||
with open(mark_file, "w") as fp:
|
with open(mark_file, "w") as fp:
|
||||||
|
Loading…
Reference in New Issue
Block a user