fix weights conversion
This commit is contained in:
parent
a71f6dc731
commit
8115224846
3 changed files with 31 additions and 3 deletions
|
|
@ -34,6 +34,9 @@ def main() -> int:
|
||||||
half = config_dict.get("half", False)
|
half = config_dict.get("half", False)
|
||||||
int8 = config_dict.get("int8", False)
|
int8 = config_dict.get("int8", False)
|
||||||
dynamic = config_dict.get("dynamic", False)
|
dynamic = config_dict.get("dynamic", False)
|
||||||
|
simplify = config_dict.get("simplify", False)
|
||||||
|
batch = config_dict.get("batch", 1)
|
||||||
|
workspace = config_dict.get("workspace", 4)
|
||||||
|
|
||||||
if not model_path or not Path(model_path).exists():
|
if not model_path or not Path(model_path).exists():
|
||||||
print(f"Model file not found: {model_path}")
|
print(f"Model file not found: {model_path}")
|
||||||
|
|
@ -46,14 +49,17 @@ def main() -> int:
|
||||||
model = YOLO(model_path)
|
model = YOLO(model_path)
|
||||||
|
|
||||||
print(f"Запуск экспорта в формат {export_format}...", flush=True)
|
print(f"Запуск экспорта в формат {export_format}...", flush=True)
|
||||||
print(f"Параметры: imgsz={imgsz}, half={half}, int8={int8}, dynamic={dynamic}", flush=True)
|
print(f"Параметры: imgsz={imgsz}, half={half}, int8={int8}, dynamic={dynamic}, simplify={simplify}, batch={batch}, workspace={workspace}", flush=True)
|
||||||
|
|
||||||
exported_path = model.export(
|
exported_path = model.export(
|
||||||
format=export_format,
|
format=export_format,
|
||||||
imgsz=imgsz,
|
imgsz=imgsz,
|
||||||
half=half,
|
half=half,
|
||||||
int8=int8,
|
int8=int8,
|
||||||
dynamic=dynamic
|
dynamic=dynamic,
|
||||||
|
simplify=simplify,
|
||||||
|
batch=batch,
|
||||||
|
workspace=workspace
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f"Экспорт завершен успешно.", flush=True)
|
print(f"Экспорт завершен успешно.", flush=True)
|
||||||
|
|
|
||||||
|
|
@ -1124,7 +1124,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
imgsz: readNumber('export-imgsz', 640, true),
|
imgsz: readNumber('export-imgsz', 640, true),
|
||||||
half: document.getElementById('export-half').checked,
|
half: document.getElementById('export-half').checked,
|
||||||
int8: document.getElementById('export-int8').checked,
|
int8: document.getElementById('export-int8').checked,
|
||||||
dynamic: document.getElementById('export-dynamic').checked
|
dynamic: document.getElementById('export-dynamic').checked,
|
||||||
|
simplify: document.getElementById('export-simplify').checked,
|
||||||
|
batch: readNumber('export-batch', 1, true),
|
||||||
|
workspace: readNumber('export-workspace', 4, true)
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -432,6 +432,7 @@
|
||||||
<option value="onnx">ONNX (.onnx)</option>
|
<option value="onnx">ONNX (.onnx)</option>
|
||||||
<option value="engine">TensorRT (.engine)</option>
|
<option value="engine">TensorRT (.engine)</option>
|
||||||
<option value="openvino">OpenVINO (_openvino_model/)</option>
|
<option value="openvino">OpenVINO (_openvino_model/)</option>
|
||||||
|
<option value="triton">Triton Inference Server (triton/)</option>
|
||||||
<option value="torchscript">TorchScript (.torchscript)</option>
|
<option value="torchscript">TorchScript (.torchscript)</option>
|
||||||
<option value="coreml">CoreML (.mlpackage)</option>
|
<option value="coreml">CoreML (.mlpackage)</option>
|
||||||
<option value="tflite">TFLite (.tflite)</option>
|
<option value="tflite">TFLite (.tflite)</option>
|
||||||
|
|
@ -445,6 +446,14 @@
|
||||||
<label for="export-imgsz">Размер изображения (imgsz)</label>
|
<label for="export-imgsz">Размер изображения (imgsz)</label>
|
||||||
<input type="number" id="export-imgsz" name="export-imgsz" value="640">
|
<input type="number" id="export-imgsz" name="export-imgsz" value="640">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="export-batch" title="Максимальный размер батча. Важен при Dynamic=True для TensorRT и Triton.">Макс. батч (batch)</label>
|
||||||
|
<input type="number" id="export-batch" name="export-batch" value="1" min="1">
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="export-workspace" title="Размер памяти для сборки TensorRT (ГБ).">Workspace (ГБ)</label>
|
||||||
|
<input type="number" id="export-workspace" name="export-workspace" value="4" min="1" max="64">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="toggle-row" style="padding: 10px 0;">
|
<div class="toggle-row" style="padding: 10px 0;">
|
||||||
|
|
@ -477,6 +486,16 @@
|
||||||
<span class="switch-slider"></span>
|
<span class="switch-slider"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="toggle-row" style="padding: 10px 0;">
|
||||||
|
<div class="toggle-label" title="Только для ONNX. Оптимизирует и упрощает граф модели.">
|
||||||
|
<h3>Simplify</h3>
|
||||||
|
<p>Упростить граф (ONNX)</p>
|
||||||
|
</div>
|
||||||
|
<label class="switch-container">
|
||||||
|
<input type="checkbox" id="export-simplify">
|
||||||
|
<span class="switch-slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue