Spaces:
Runtime error
Runtime error
Zengyf-CVer
commited on
Commit
•
0c1a8ce
1
Parent(s):
1d7cc1c
app update
Browse files- app.py +4 -13
- requirements.txt +2 -4
app.py
CHANGED
@@ -4,11 +4,6 @@
|
|
4 |
# 功能描述:多选,多项模型转换和打包下载
|
5 |
|
6 |
import os
|
7 |
-
|
8 |
-
os.system("pip install pip -U")
|
9 |
-
os.system("pip install nvidia-pyindex")
|
10 |
-
os.system("pip install nvidia-tensorrt")
|
11 |
-
|
12 |
import shutil
|
13 |
import time
|
14 |
import zipfile
|
@@ -46,18 +41,14 @@ def zipDir(origin_dir, compress_file):
|
|
46 |
zip.close()
|
47 |
|
48 |
|
49 |
-
# params_include_list = ["torchscript", "onnx", "openvino", "
|
50 |
def cb_opt(weight_name, btn_model_list, params_include_list):
|
51 |
|
52 |
for i in range(len(btn_model_list)):
|
53 |
if btn_model_list[i]:
|
54 |
st.info(f"正在转换{params_include_list[i]}......")
|
55 |
s = time.time()
|
56 |
-
|
57 |
-
os.system(
|
58 |
-
f'python export.py --weights ./weights/{weight_name} --include {params_include_list[i]} --device 0')
|
59 |
-
else:
|
60 |
-
os.system(f'python export.py --weights ./weights/{weight_name} --include {params_include_list[i]}')
|
61 |
e = time.time()
|
62 |
st.success(f"{params_include_list[i]}转换完成,用时{round((e-s), 2)}秒")
|
63 |
|
@@ -93,7 +84,7 @@ def main():
|
|
93 |
cb_torchscript = st.checkbox('TorchScript')
|
94 |
cb_onnx = st.checkbox('ONNX')
|
95 |
cb_openvino = st.checkbox('OpenVINO')
|
96 |
-
cb_engine = st.checkbox('TensorRT')
|
97 |
cb_coreml = st.checkbox('CoreML')
|
98 |
cb_saved_model = st.checkbox('TensorFlow SavedModel')
|
99 |
cb_pb = st.checkbox('TensorFlow GraphDef')
|
@@ -104,7 +95,7 @@ def main():
|
|
104 |
btn_convert = st.button('转换')
|
105 |
|
106 |
btn_model_list = [
|
107 |
-
cb_torchscript, cb_onnx, cb_openvino,
|
108 |
|
109 |
params_include_list = [
|
110 |
"torchscript", "onnx", "openvino", "engine", "coreml", "saved_model", "pb", "tflite", "tfjs"]
|
|
|
4 |
# 功能描述:多选,多项模型转换和打包下载
|
5 |
|
6 |
import os
|
|
|
|
|
|
|
|
|
|
|
7 |
import shutil
|
8 |
import time
|
9 |
import zipfile
|
|
|
41 |
zip.close()
|
42 |
|
43 |
|
44 |
+
# params_include_list = ["torchscript", "onnx", "openvino", "coreml", "saved_model", "pb", "tflite", "tfjs"]
|
45 |
def cb_opt(weight_name, btn_model_list, params_include_list):
|
46 |
|
47 |
for i in range(len(btn_model_list)):
|
48 |
if btn_model_list[i]:
|
49 |
st.info(f"正在转换{params_include_list[i]}......")
|
50 |
s = time.time()
|
51 |
+
os.system(f'python export.py --weights ./weights/{weight_name} --include {params_include_list[i]}')
|
|
|
|
|
|
|
|
|
52 |
e = time.time()
|
53 |
st.success(f"{params_include_list[i]}转换完成,用时{round((e-s), 2)}秒")
|
54 |
|
|
|
84 |
cb_torchscript = st.checkbox('TorchScript')
|
85 |
cb_onnx = st.checkbox('ONNX')
|
86 |
cb_openvino = st.checkbox('OpenVINO')
|
87 |
+
# cb_engine = st.checkbox('TensorRT')
|
88 |
cb_coreml = st.checkbox('CoreML')
|
89 |
cb_saved_model = st.checkbox('TensorFlow SavedModel')
|
90 |
cb_pb = st.checkbox('TensorFlow GraphDef')
|
|
|
95 |
btn_convert = st.button('转换')
|
96 |
|
97 |
btn_model_list = [
|
98 |
+
cb_torchscript, cb_onnx, cb_openvino, cb_coreml, cb_saved_model, cb_pb, cb_tflite, cb_tfjs]
|
99 |
|
100 |
params_include_list = [
|
101 |
"torchscript", "onnx", "openvino", "engine", "coreml", "saved_model", "pb", "tflite", "tfjs"]
|
requirements.txt
CHANGED
@@ -32,11 +32,9 @@ seaborn
|
|
32 |
coremltools # CoreML export
|
33 |
onnx # ONNX export
|
34 |
onnx-simplifier # ONNX simplifier
|
35 |
-
onnxruntime
|
36 |
-
# nvidia-pyindex==1.0.9
|
37 |
-
# nvidia-tensorrt==8.4.1.5
|
38 |
scikit-learn==0.19.2 # CoreML quantization
|
39 |
-
tensorflow # TFLite export
|
40 |
tensorflowjs # TF.js export
|
41 |
openvino-dev # OpenVINO export
|
42 |
|
|
|
32 |
coremltools # CoreML export
|
33 |
onnx # ONNX export
|
34 |
onnx-simplifier # ONNX simplifier
|
35 |
+
onnxruntime
|
|
|
|
|
36 |
scikit-learn==0.19.2 # CoreML quantization
|
37 |
+
tensorflow-cpu # TFLite export
|
38 |
tensorflowjs # TF.js export
|
39 |
openvino-dev # OpenVINO export
|
40 |
|