Skill: wray151/xeon-smartupscale (version 0.1.3)

--- name: xeon-smartupscale description: 智能视频超分。任意目标分辨率（1080p/1440p/4K…），自动用 lanczos 预缩放对齐到 ETDS 2x 模型的输入尺寸，再做 AI 超分。CPU 推理，Intel AMX BF16 加速。 metadata: openclaw: requires: bins: [bash, python3, curl, tar] --- ## 目标 echo 480p → 1080p、720p → 4K），即使比例不是整数 2x 也能搞定。"--- ETDS 模型只支持 **严格 2x** 超分，所以本 skill 自动： 1. 用 ffmpeg **lanczos 预缩放**，把输入压（或拉）到 `target/2` 2. 用 ETDS x2 OpenVINO 模型把 `target/2` → `target` ## 适用场景 - AI 生成视频（Seedance / Sora 等）480p → 1080p - 720p 老片源 → 4K (2160p) - 任意非整数倍率的分辨率提升 - 纯 CPU 环境（Intel Xeon AMX 加速） ## 执行流程 exec 调用，只替换输入路径和目标： ```bash bash <skill_dir>/smartupscale.sh <输入视频绝对路径> -t 1080p ``` echo "--- created ---"`480p` `540p` `720p` `1080p` `1440p` `2160p` `4k`，也可以直接写 `1920x1080`。 echo "--- created ---" ```bash bash <skill_dir>/smartupscale.sh <input.mp4> -t 1080p -o <output.mp4> ``` --- `-o` 则输出到 `<输入名>_smart_<W>x<H>.mp4`。 ## 注意事项 - 输入 / 输出都用 **绝对路径** - 目标分辨率按高度对齐，宽度按输入宽高比自动算（保持 AR） - 若输入已经 ≥ 目标，会退化为单步 lanczos 缩放 - 若输入恰好就是 `target/2`，会跳过 lanczos 直接 ETDS 2x - 输出固定 H.264 / CRF 18，自动合并原音轨 ## 限制 - 仅 Linux x86_64（OpenVINO CPU plugin） - 单次最多 2x 链路（先 lanczos 后 ETDS），不会做多级 AI 超分 - 逐帧推理，长视频会比较耗时（参考 ETDS 速度：Xeon AMX 上 ~14 fps 推理） - 模型固定为 ETDS_M7C48_x2（已 vendored，~380KB） ## 安装 echo "--- created ---"`bash <skill_dir>/install.sh`

path: README.md
content: # xeon-smartupscale

Smart hybrid video upscaler for Intel Xeon CPUs: **lanczos pre-scale + ETDS 2x AI super-resolution**.

ETDS only supports a strict 2x scale factor. This skill bridges the gap so you can target *any* resolution (1080p, 1440p, 4K…) regardless of input size, by:

1. ffmpeg `lanczos` → `(target_w/2, target_h/2)`
2. ETDS x2 (OpenVINO CPU, AMX-BF16) → `(target_w, target_h)`

## Install
```bash
bash install.sh
```

## Usage
```bash
./smartupscale.sh input.mp4 -t 1080p
./smartupscale.sh input.mp4 -t 4k -o out_4k.mp4
./smartupscale.sh input.mp4 -t 1920x1080
```
Targets: `480p`, `540p`, `720p`, `1080p`, `1440p`, `2160p`, `4k`, or explicit `WxH`.

## Notes
- Linux x86_64 only.
- Best on Intel CPUs with AMX-BF16 (Sapphire Rapids / Granite Rapids).
- Output: H.264 CRF 18, original audio merged.
- Model `ETDS_M7C48_x2` is vendored (~380KB).


path: install.sh
content: #!/usr/bin/env bash
set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$DIR"

PYTHON=""
for py in python3.13 python3.12 python3.11 python3.10 python3.9 python3; do
  if command -v "$py" &>/dev/null; then
    ver=$("$py" -c "import sys; print(sys.version_info.minor)" 2>/dev/null || echo 0)
    if [[ "$ver" -ge 9 ]] 2>/dev/null; then PYTHON="$py"; break; fi
  fi
done
[[ -z "$PYTHON" ]] && { echo "Error: Python 3.9+ not found." >&2; exit 1; }
echo "Using Python: $PYTHON ($($PYTHON --version))"

if [[ ! -d "$DIR/.venv" ]]; then
  echo "Creating venv..."
  "$PYTHON" -m venv "$DIR/.venv" 2>/dev/null || "$PYTHON" -m venv --without-pip "$DIR/.venv"
fi
source "$DIR/.venv/bin/activate"

if ! python -m pip --version &>/dev/null; then
  echo "Bootstrapping pip..."
  curl -sSL https://bootstrap.pypa.io/get-pip.py | python
fi
python -m pip install --upgrade pip >/dev/null
python -m pip install "openvino==2025.2.0" numpy opencv-python-headless

mkdir -p "$DIR/bin"
if [[ ! -x "$DIR/bin/ffmpeg" || ! -x "$DIR/bin/ffprobe" ]]; then
  if command -v ffmpeg &>/dev/null && command -v ffprobe &>/dev/null; then
    ln -sf "$(command -v ffmpeg)" "$DIR/bin/ffmpeg"
    ln -sf "$(command -v ffprobe)" "$DIR/bin/ffprobe"
    echo "Linked system ffmpeg."
  else
    echo "Downloading static ffmpeg..."
    tmp="$(mktemp -d)"
    curl -sSL https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -o "$tmp/ff.tar.xz"
    tar -xf "$tmp/ff.tar.xz" -C "$tmp/"
    cp "$tmp"/ffmpeg-*-amd64-static/ffmpeg "$DIR/bin/ffmpeg"
    cp "$tmp"/ffmpeg-*-amd64-static/ffprobe "$DIR/bin/ffprobe"
    chmod +x "$DIR/bin/ffmpeg" "$DIR/bin/ffprobe"
    rm -rf "$tmp"
  fi
fi
chmod +x "$DIR/smartupscale.sh"

# Decode model weights if only .b64 exists
if [[ ! -f "$DIR/model/ETDS_M7C48_x2.bin" && -f "$DIR/model/ETDS_M7C48_x2.bin.b64" ]]; then
  echo "Decoding model weights..."
  base64 -d "$DIR/model/ETDS_M7C48_x2.bin.b64" > "$DIR/model/ETDS_M7C48_x2.bin"
fi

echo "✔ xeon-smartupscale ready."


path: model/ETDS_M7C48_x2.xml
content: <?xml version="1.0"?>
<net name="torch-jit-export" version="11">
	<layers>
		<layer id="0" name="input" type="Parameter" version="opset1">
			<data shape="?,3,?,?" element_type="f32" />
			<output>
				<port id="0" precision="FP32" names="input">
					<dim>-1</dim>
					<dim>3</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="1" name="conv_first.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 3, 3, 3" offset="0" size="2592" />
			<output>
				<port id="0" precision="FP16" names="conv_first.weight">
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="2" name="conv_first.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="3" name="Conv_0/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>3</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="4" name="conv_first.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="2592" size="96" />
			<output>
				<port id="0" precision="FP16" names="conv_first.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="5" name="conv_first.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="6" name="Constant_25" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="7" name="ShapeOf_31" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="8" name="ShapeOf_23" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="9" name="ShapeOf_24" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="10" name="Constant_26" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="11" name="Subtract_27" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="12" name="Broadcast_28" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="13" name="Concat_32" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="14" name="Reshape_33" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="15" name="Conv_0" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="21">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="16" name="Relu_1" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="22">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="17" name="backbone_convs.0.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 48, 3, 3" offset="2704" size="41472" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.0.weight">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="18" name="backbone_convs.0.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="19" name="Conv_2/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="20" name="backbone_convs.0.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="44176" size="96" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.0.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="21" name="backbone_convs.0.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="22" name="Constant_39" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="23" name="ShapeOf_45" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="24" name="ShapeOf_37" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="25" name="ShapeOf_38" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="26" name="Constant_40" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="27" name="Subtract_41" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="28" name="Broadcast_42" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="29" name="Concat_46" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="30" name="Reshape_47" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="31" name="Conv_2" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="23">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="32" name="Relu_3" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="24">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="33" name="backbone_convs.1.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 48, 3, 3" offset="44272" size="41472" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.1.weight">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="34" name="backbone_convs.1.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="35" name="Conv_4/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="36" name="backbone_convs.1.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="85744" size="96" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.1.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="37" name="backbone_convs.1.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="38" name="Constant_53" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="39" name="ShapeOf_59" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="40" name="ShapeOf_51" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="41" name="ShapeOf_52" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="42" name="Constant_54" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="43" name="Subtract_55" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="44" name="Broadcast_56" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="45" name="Concat_60" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="46" name="Reshape_61" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="47" name="Conv_4" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="25">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="48" name="Relu_5" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="26">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="49" name="backbone_convs.2.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 48, 3, 3" offset="85840" size="41472" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.2.weight">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="50" name="backbone_convs.2.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="51" name="Conv_6/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="52" name="backbone_convs.2.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="127312" size="96" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.2.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="53" name="backbone_convs.2.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="54" name="Constant_67" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="55" name="ShapeOf_73" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="56" name="ShapeOf_65" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="57" name="ShapeOf_66" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="58" name="Constant_68" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="59" name="Subtract_69" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="60" name="Broadcast_70" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="61" name="Concat_74" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="62" name="Reshape_75" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="63" name="Conv_6" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="27">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="64" name="Relu_7" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="28">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="65" name="backbone_convs.3.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 48, 3, 3" offset="127408" size="41472" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.3.weight">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="66" name="backbone_convs.3.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="67" name="Conv_8/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="68" name="backbone_convs.3.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="168880" size="96" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.3.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="69" name="backbone_convs.3.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="70" name="Constant_81" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="71" name="ShapeOf_87" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="72" name="ShapeOf_79" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="73" name="ShapeOf_80" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="74" name="Constant_82" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="75" name="Subtract_83" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="76" name="Broadcast_84" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="77" name="Concat_88" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="78" name="Reshape_89" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="79" name="Conv_8" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="29">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="80" name="Relu_9" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="30">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="81" name="backbone_convs.4.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 48, 3, 3" offset="168976" size="41472" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.4.weight">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="82" name="backbone_convs.4.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="83" name="Conv_10/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="84" name="backbone_convs.4.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="210448" size="96" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.4.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="85" name="backbone_convs.4.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="86" name="Constant_95" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="87" name="ShapeOf_101" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="88" name="ShapeOf_93" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="89" name="ShapeOf_94" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="90" name="Constant_96" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="91" name="Subtract_97" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="92" name="Broadcast_98" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="93" name="Concat_102" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="94" name="Reshape_103" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="95" name="Conv_10" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="31">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="96" name="Relu_11" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="97" name="backbone_convs.5.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 48, 3, 3" offset="210544" size="41472" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.5.weight">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="98" name="backbone_convs.5.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="99" name="Conv_12/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="100" name="backbone_convs.5.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="252016" size="96" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.5.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="101" name="backbone_convs.5.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="102" name="Constant_109" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="103" name="ShapeOf_115" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="104" name="ShapeOf_107" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="105" name="ShapeOf_108" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="106" name="Constant_110" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="107" name="Subtract_111" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="108" name="Broadcast_112" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="109" name="Concat_116" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="110" name="Reshape_117" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="111" name="Conv_12" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="33">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="112" name="Relu_13" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="34">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="113" name="backbone_convs.6.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48, 48, 3, 3" offset="252112" size="41472" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.6.weight">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="114" name="backbone_convs.6.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="115" name="Conv_14/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>48</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="116" name="backbone_convs.6.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="48" offset="293584" size="96" />
			<output>
				<port id="0" precision="FP16" names="backbone_convs.6.bias">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="117" name="backbone_convs.6.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>48</dim>
				</port>
			</output>
		</layer>
		<layer id="118" name="Constant_123" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="119" name="ShapeOf_129" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="120" name="ShapeOf_121" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="121" name="ShapeOf_122" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="122" name="Constant_124" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="123" name="Subtract_125" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="124" name="Broadcast_126" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="125" name="Concat_130" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="126" name="Reshape_131" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>48</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="127" name="Conv_14" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>48</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="35">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="128" name="Relu_15" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="36">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="129" name="conv_last.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="12, 48, 3, 3" offset="293680" size="10368" />
			<output>
				<port id="0" precision="FP16" names="conv_last.weight">
					<dim>12</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="130" name="conv_last.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>12</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>12</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</output>
		</layer>
		<layer id="131" name="Conv_16/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="1, 1" pads_end="1, 1" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>48</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>12</dim>
					<dim>48</dim>
					<dim>3</dim>
					<dim>3</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="132" name="conv_last.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="12" offset="304048" size="24" />
			<output>
				<port id="0" precision="FP16" names="conv_last.bias">
					<dim>12</dim>
				</port>
			</output>
		</layer>
		<layer id="133" name="conv_last.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>12</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>12</dim>
				</port>
			</output>
		</layer>
		<layer id="134" name="Constant_137" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="135" name="ShapeOf_143" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>12</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="136" name="ShapeOf_135" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="137" name="ShapeOf_136" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="138" name="Constant_138" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="139" name="Subtract_139" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="140" name="Broadcast_140" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="141" name="Concat_144" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="142" name="Reshape_145" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>12</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="143" name="Conv_16" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="37">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="144" name="Relu_17" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="38">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="145" name="conv_clip.weight_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="12, 12, 1, 1" offset="304072" size="288" />
			<output>
				<port id="0" precision="FP16" names="conv_clip.weight">
					<dim>12</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="146" name="conv_clip.weight" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>12</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>12</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="147" name="Conv_18/WithoutBiases" type="Convolution" version="opset1">
			<data strides="1, 1" dilations="1, 1" pads_begin="0, 0" pads_end="0, 0" auto_pad="explicit" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>12</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="148" name="conv_clip.bias_compressed" type="Const" version="opset1">
			<data element_type="f16" shape="12" offset="304360" size="24" />
			<output>
				<port id="0" precision="FP16" names="conv_clip.bias">
					<dim>12</dim>
				</port>
			</output>
		</layer>
		<layer id="149" name="conv_clip.bias" type="Convert" version="opset1">
			<data destination_type="f32" />
			<rt_info>
				<attribute name="decompression" version="0" />
			</rt_info>
			<input>
				<port id="0" precision="FP16">
					<dim>12</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32">
					<dim>12</dim>
				</port>
			</output>
		</layer>
		<layer id="150" name="Constant_151" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2688" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="151" name="ShapeOf_157" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>12</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="152" name="ShapeOf_149" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="153" name="ShapeOf_150" type="ShapeOf" version="opset3">
			<data output_type="i64" />
			<input>
				<port id="0" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="154" name="Constant_152" type="Const" version="opset1">
			<data element_type="i64" shape="1" offset="2696" size="8" />
			<rt_info>
				<attribute name="precise" version="0" />
			</rt_info>
			<output>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="155" name="Subtract_153" type="Subtract" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="156" name="Broadcast_154" type="Broadcast" version="opset3">
			<data mode="numpy" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</output>
		</layer>
		<layer id="157" name="Concat_158" type="Concat" version="opset1">
			<data axis="0" />
			<input>
				<port id="0" precision="I64">
					<dim>1</dim>
				</port>
				<port id="1" precision="I64">
					<dim>1</dim>
				</port>
				<port id="2" precision="I64">
					<dim>2</dim>
				</port>
			</input>
			<output>
				<port id="3" precision="I64">
					<dim>4</dim>
				</port>
			</output>
		</layer>
		<layer id="158" name="Reshape_159" type="Reshape" version="opset1">
			<data special_zero="false" />
			<input>
				<port id="0" precision="FP32">
					<dim>12</dim>
				</port>
				<port id="1" precision="I64">
					<dim>4</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="159" name="Conv_18" type="Add" version="opset1">
			<data auto_broadcast="numpy" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>12</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32" names="39">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="160" name="Relu_19" type="ReLU" version="opset1">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="40">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="161" name="output" type="DepthToSpace" version="opset1">
			<data block_size="2" mode="depth_first" />
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>12</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
			<output>
				<port id="1" precision="FP32" names="output">
					<dim>-1</dim>
					<dim>3</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</output>
		</layer>
		<layer id="162" name="output/sink_port_0" type="Result" version="opset1" output_names="output">
			<input>
				<port id="0" precision="FP32">
					<dim>-1</dim>
					<dim>3</dim>
					<dim>-1</dim>
					<dim>-1</dim>
				</port>
			</input>
		</layer>
	</layers>
	<edges>
		<edge from-layer="0" from-port="0" to-layer="3" to-port="0" />
		<edge from-layer="1" from-port="0" to-layer="2" to-port="0" />
		<edge from-layer="2" from-port="1" to-layer="3" to-port="1" />
		<edge from-layer="3" from-port="2" to-layer="15" to-port="0" />
		<edge from-layer="3" from-port="2" to-layer="8" to-port="0" />
		<edge from-layer="4" from-port="0" to-layer="5" to-port="0" />
		<edge from-layer="5" from-port="1" to-layer="14" to-port="0" />
		<edge from-layer="5" from-port="1" to-layer="7" to-port="0" />
		<edge from-layer="6" from-port="0" to-layer="12" to-port="0" />
		<edge from-layer="6" from-port="0" to-layer="13" to-port="0" />
		<edge from-layer="7" from-port="1" to-layer="13" to-port="1" />
		<edge from-layer="8" from-port="1" to-layer="9" to-port="0" />
		<edge from-layer="9" from-port="1" to-layer="11" to-port="0" />
		<edge from-layer="10" from-port="0" to-layer="11" to-port="1" />
		<edge from-layer="11" from-port="2" to-layer="12" to-port="1" />
		<edge from-layer="12" from-port="2" to-layer="13" to-port="2" />
		<edge from-layer="13" from-port="3" to-layer="14" to-port="1" />
		<edge from-layer="14" from-port="2" to-layer="15" to-port="1" />
		<edge from-layer="15" from-port="2" to-layer="16" to-port="0" />
		<edge from-layer="16" from-port="1" to-layer="19" to-port="0" />
		<edge from-layer="17" from-port="0" to-layer="18" to-port="0" />
		<edge from-layer="18" from-port="1" to-layer="19" to-port="1" />
		<edge from-layer="19" from-port="2" to-layer="24" to-port="0" />
		<edge from-layer="19" from-port="2" to-layer="31" to-port="0" />
		<edge from-layer="20" from-port="0" to-layer="21" to-port="0" />
		<edge from-layer="21" from-port="1" to-layer="23" to-port="0" />
		<edge from-layer="21" from-port="1" to-layer="30" to-port="0" />
		<edge from-layer="22" from-port="0" to-layer="28" to-port="0" />
		<edge from-layer="22" from-port="0" to-layer="29" to-port="0" />
		<edge from-layer="23" from-port="1" to-layer="29" to-port="1" />
		<edge from-layer="24" from-port="1" to-layer="25" to-port="0" />
		<edge from-layer="25" from-port="1" to-layer="27" to-port="0" />
		<edge from-layer="26" from-port="0" to-layer="27" to-port="1" />
		<edge from-layer="27" from-port="2" to-layer="28" to-port="1" />
		<edge from-layer="28" from-port="2" to-layer="29" to-port="2" />
		<edge from-layer="29" from-port="3" to-layer="30" to-port="1" />
		<edge from-layer="30" from-port="2" to-layer="31" to-port="1" />
		<edge from-layer="31" from-port="2" to-layer="32" to-port="0" />
		<edge from-layer="32" from-port="1" to-layer="35" to-port="0" />
		<edge from-layer="33" from-port="0" to-layer="34" to-port="0" />
		<edge from-layer="34" from-port="1" to-layer="35" to-port="1" />
		<edge from-layer="35" from-port="2" to-layer="40" to-port="0" />
		<edge from-layer="35" from-port="2" to-layer="47" to-port="0" />
		<edge from-layer="36" from-port="0" to-layer="37" to-port="0" />
		<edge from-layer="37" from-port="1" to-layer="39" to-port="0" />
		<edge from-layer="37" from-port="1" to-layer="46" to-port="0" />
		<edge from-layer="38" from-port="0" to-layer="45" to-port="0" />
		<edge from-layer="38" from-port="0" to-layer="44" to-port="0" />
		<edge from-layer="39" from-port="1" to-layer="45" to-port="1" />
		<edge from-layer="40" from-port="1" to-layer="41" to-port="0" />
		<edge from-layer="41" from-port="1" to-layer="43" to-port="0" />
		<edge from-layer="42" from-port="0" to-layer="43" to-port="1" />
		<edge from-layer="43" from-port="2" to-layer="44" to-port="1" />
		<edge from-layer="44" from-port="2" to-layer="45" to-port="2" />
		<edge from-layer="45" from-port="3" to-layer="46" to-port="1" />
		<edge from-layer="46" from-port="2" to-layer="47" to-port="1" />
		<edge from-layer="47" from-port="2" to-layer="48" to-port="0" />
		<edge from-layer="48" from-port="1" to-layer="51" to-port="0" />
		<edge from-layer="49" from-port="0" to-layer="50" to-port="0" />
		<edge from-layer="50" from-port="1" to-layer="51" to-port="1" />
		<edge from-layer="51" from-port="2" to-layer="63" to-port="0" />
		<edge from-layer="51" from-port="2" to-layer="56" to-port="0" />
		<edge from-layer="52" from-port="0" to-layer="53" to-port="0" />
		<edge from-layer="53" from-port="1" to-layer="62" to-port="0" />
		<edge from-layer="53" from-port="1" to-layer="55" to-port="0" />
		<edge from-layer="54" from-port="0" to-layer="60" to-port="0" />
		<edge from-layer="54" from-port="0" to-layer="61" to-port="0" />
		<edge from-layer="55" from-port="1" to-layer="61" to-port="1" />
		<edge from-layer="56" from-port="1" to-layer="57" to-port="0" />
		<edge from-layer="57" from-port="1" to-layer="59" to-port="0" />
		<edge from-layer="58" from-port="0" to-layer="59" to-port="1" />
		<edge from-layer="59" from-port="2" to-layer="60" to-port="1" />
		<edge from-layer="60" from-port="2" to-layer="61" to-port="2" />
		<edge from-layer="61" from-port="3" to-layer="62" to-port="1" />
		<edge from-layer="62" from-port="2" to-layer="63" to-port="1" />
		<edge from-layer="63" from-port="2" to-layer="64" to-port="0" />
		<edge from-layer="64" from-port="1" to-layer="67" to-port="0" />
		<edge from-layer="65" from-port="0" to-layer="66" to-port="0" />
		<edge from-layer="66" from-port="1" to-layer="67" to-port="1" />
		<edge from-layer="67" from-port="2" to-layer="72" to-port="0" />
		<edge from-layer="67" from-port="2" to-layer="79" to-port="0" />
		<edge from-layer="68" from-port="0" to-layer="69" to-port="0" />
		<edge from-layer="69" from-port="1" to-layer="71" to-port="0" />
		<edge from-layer="69" from-port="1" to-layer="78" to-port="0" />
		<edge from-layer="70" from-port="0" to-layer="76" to-port="0" />
		<edge from-layer="70" from-port="0" to-layer="77" to-port="0" />
		<edge from-layer="71" from-port="1" to-layer="77" to-port="1" />
		<edge from-layer="72" from-port="1" to-layer="73" to-port="0" />
		<edge from-layer="73" from-port="1" to-layer="75" to-port="0" />
		<edge from-layer="74" from-port="0" to-layer="75" to-port="1" />
		<edge from-layer="75" from-port="2" to-layer="76" to-port="1" />
		<edge from-layer="76" from-port="2" to-layer="77" to-port="2" />
		<edge from-layer="77" from-port="3" to-layer="78" to-port="1" />
		<edge from-layer="78" from-port="2" to-layer="79" to-port="1" />
		<edge from-layer="79" from-port="2" to-layer="80" to-port="0" />
		<edge from-layer="80" from-port="1" to-layer="83" to-port="0" />
		<edge from-layer="81" from-port="0" to-layer="82" to-port="0" />
		<edge from-layer="82" from-port="1" to-layer="83" to-port="1" />
		<edge from-layer="83" from-port="2" to-layer="88" to-port="0" />
		<edge from-layer="83" from-port="2" to-layer="95" to-port="0" />
		<edge from-layer="84" from-port="0" to-layer="85" to-port="0" />
		<edge from-layer="85" from-port="1" to-layer="87" to-port="0" />
		<edge from-layer="85" from-port="1" to-layer="94" to-port="0" />
		<edge from-layer="86" from-port="0" to-layer="92" to-port="0" />
		<edge from-layer="86" from-port="0" to-layer="93" to-port="0" />
		<edge from-layer="87" from-port="1" to-layer="93" to-port="1" />
		<edge from-layer="88" from-port="1" to-layer="89" to-port="0" />
		<edge from-layer="89" from-port="1" to-layer="91" to-port="0" />
		<edge from-layer="90" from-port="0" to-layer="91" to-port="1" />
		<edge from-layer="91" from-port="2" to-layer="92" to-port="1" />
		<edge from-layer="92" from-port="2" to-layer="93" to-port="2" />
		<edge from-layer="93" from-port="3" to-layer="94" to-port="1" />
		<edge from-layer="94" from-port="2" to-layer="95" to-port="1" />
		<edge from-layer="95" from-port="2" to-layer="96" to-port="0" />
		<edge from-layer="96" from-port="1" to-layer="99" to-port="0" />
		<edge from-layer="97" from-port="0" to-layer="98" to-port="0" />
		<edge from-layer="98" from-port="1" to-layer="99" to-port="1" />
		<edge from-layer="99" from-port="2" to-layer="104" to-port="0" />
		<edge from-layer="99" from-port="2" to-layer="111" to-port="0" />
		<edge from-layer="100" from-port="0" to-layer="101" to-port="0" />
		<edge from-layer="101" from-port="1" to-layer="103" to-port="0" />
		<edge from-layer="101" from-port="1" to-layer="110" to-port="0" />
		<edge from-layer="102" from-port="0" to-layer="108" to-port="0" />
		<edge from-layer="102" from-port="0" to-layer="109" to-port="0" />
		<edge from-layer="103" from-port="1" to-layer="109" to-port="1" />
		<edge from-layer="104" from-port="1" to-layer="105" to-port="0" />
		<edge from-layer="105" from-port="1" to-layer="107" to-port="0" />
		<edge from-layer="106" from-port="0" to-layer="107" to-port="1" />
		<edge from-layer="107" from-port="2" to-layer="108" to-port="1" />
		<edge from-layer="108" from-port="2" to-layer="109" to-port="2" />
		<edge from-layer="109" from-port="3" to-layer="110" to-port="1" />
		<edge from-layer="110" from-port="2" to-layer="111" to-port="1" />
		<edge from-layer="111" from-port="2" to-layer="112" to-port="0" />
		<edge from-layer="112" from-port="1" to-layer="115" to-port="0" />
		<edge from-layer="113" from-port="0" to-layer="114" to-port="0" />
		<edge from-layer="114" from-port="1" to-layer="115" to-port="1" />
		<edge from-layer="115" from-port="2" to-layer="120" to-port="0" />
		<edge from-layer="115" from-port="2" to-layer="127" to-port="0" />
		<edge from-layer="116" from-port="0" to-layer="117" to-port="0" />
		<edge from-layer="117" from-port="1" to-layer="119" to-port="0" />
		<edge from-layer="117" from-port="1" to-layer="126" to-port="0" />
		<edge from-layer="118" from-port="0" to-layer="125" to-port="0" />
		<edge from-layer="118" from-port="0" to-layer="124" to-port="0" />
		<edge from-layer="119" from-port="1" to-layer="125" to-port="1" />
		<edge from-layer="120" from-port="1" to-layer="121" to-port="0" />
		<edge from-layer="121" from-port="1" to-layer="123" to-port="0" />
		<edge from-layer="122" from-port="0" to-layer="123" to-port="1" />
		<edge from-layer="123" from-port="2" to-layer="124" to-port="1" />
		<edge from-layer="124" from-port="2" to-layer="125" to-port="2" />
		<edge from-layer="125" from-port="3" to-layer="126" to-port="1" />
		<edge from-layer="126" from-port="2" to-layer="127" to-port="1" />
		<edge from-layer="127" from-port="2" to-layer="128" to-port="0" />
		<edge from-layer="128" from-port="1" to-layer="131" to-port="0" />
		<edge from-layer="129" from-port="0" to-layer="130" to-port="0" />
		<edge from-layer="130" from-port="1" to-layer="131" to-port="1" />
		<edge from-layer="131" from-port="2" to-layer="143" to-port="0" />
		<edge from-layer="131" from-port="2" to-layer="136" to-port="0" />
		<edge from-layer="132" from-port="0" to-layer="133" to-port="0" />
		<edge from-layer="133" from-port="1" to-layer="135" to-port="0" />
		<edge from-layer="133" from-port="1" to-layer="142" to-port="0" />
		<edge from-layer="134" from-port="0" to-layer="140" to-port="0" />
		<edge from-layer="134" from-port="0" to-layer="141" to-port="0" />
		<edge from-layer="135" from-port="1" to-layer="141" to-port="1" />
		<edge from-layer="136" from-port="1" to-layer="137" to-port="0" />
		<edge from-layer="137" from-port="1" to-layer="139" to-port="0" />
		<edge from-layer="138" from-port="0" to-layer="139" to-port="1" />
		<edge from-layer="139" from-port="2" to-layer="140" to-port="1" />
		<edge from-layer="140" from-port="2" to-layer="141" to-port="2" />
		<edge from-layer="141" from-port="3" to-layer="142" to-port="1" />
		<edge from-layer="142" from-port="2" to-layer="143" to-port="1" />
		<edge from-layer="143" from-port="2" to-layer="144" to-port="0" />
		<edge from-layer="144" from-port="1" to-layer="147" to-port="0" />
		<edge from-layer="145" from-port="0" to-layer="146" to-port="0" />
		<edge from-layer="146" from-port="1" to-layer="147" to-port="1" />
		<edge from-layer="147" from-port="2" to-layer="152" to-port="0" />
		<edge from-layer="147" from-port="2" to-layer="159" to-port="0" />
		<edge from-layer="148" from-port="0" to-layer="149" to-port="0" />
		<edge from-layer="149" from-port="1" to-layer="151" to-port="0" />
		<edge from-layer="149" from-port="1" to-layer="158" to-port="0" />
		<edge from-layer="150" from-port="0" to-layer="156" to-port="0" />
		<edge from-layer="150" from-port="0" to-layer="157" to-port="0" />
		<edge from-layer="151" from-port="1" to-layer="157" to-port="1" />
		<edge from-layer="152" from-port="1" to-layer="153" to-port="0" />
		<edge from-layer="153" from-port="1" to-layer="155" to-port="0" />
		<edge from-layer="154" from-port="0" to-layer="155" to-port="1" />
		<edge from-layer="155" from-port="2" to-layer="156" to-port="1" />
		<edge from-layer="156" from-port="2" to-layer="157" to-port="2" />
		<edge from-layer="157" from-port="3" to-layer="158" to-port="1" />
		<edge from-layer="158" from-port="2" to-layer="159" to-port="1" />
		<edge from-layer="159" from-port="2" to-layer="160" to-port="0" />
		<edge from-layer="160" from-port="1" to-layer="161" to-port="0" />
		<edge from-layer="161" from-port="1" to-layer="162" to-port="0" />
	</edges>
	<rt_info />
</net>


path: smartupscale.sh
content: #!/usr/bin/env bash
# Smart video upscale: lanczos pre-scale + N rounds of ETDS 2x super-resolution
#
# Pipeline:
#   - Pick smallest N such that 2^N >= max(target_w/in_w, target_h/in_h)
#   - Round target to multiple of 2^N (preserves AR if user gave only -t HEIGHT)
#   - Lanczos input -> (target_w / 2^N, target_h / 2^N)
#   - Run ETDS x2 N times, doubling each time, landing on target
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

INPUT=""
TARGET="1080p"
OUTPUT=""
KEEP_INTERMEDIATE=0

usage() {
  cat <<EOF
Usage: $(basename "$0") <input_video> [-t <target>] [-o <output>] [--keep]

  -t, --target   Target: 480p|540p|720p|1080p|1440p|2160p|4k|WxH (default: 1080p)
                 With WxH the aspect ratio is taken as-is (may stretch).
                 With a height-only preset the width is auto-computed from the
                 input aspect ratio.
  -o, --output   Output path (default: <input>_smart_<W>x<H>.mp4)
      --keep     Keep intermediate stage files
  -h, --help     Show this help
EOF
}

while [[ $# -gt 0 ]]; do
  case "$1" in
    -t|--target) TARGET="$2"; shift 2;;
    -o|--output) OUTPUT="$2"; shift 2;;
    --keep) KEEP_INTERMEDIATE=1; shift;;
    -h|--help) usage; exit 0;;
    -*) echo "Unknown option: $1" >&2; usage; exit 2;;
    *) INPUT="$1"; shift;;
  esac
done

[[ -z "$INPUT" ]] && { echo "Error: input video required" >&2; usage; exit 2; }
[[ ! -f "$INPUT" ]] && { echo "Error: input not found: $INPUT" >&2; exit 1; }

FFMPEG="$DIR/bin/ffmpeg"
FFPROBE="$DIR/bin/ffprobe"
if [[ ! -x "$FFMPEG" || ! -x "$FFPROBE" ]]; then
  if command -v ffmpeg &>/dev/null && command -v ffprobe &>/dev/null; then
    FFMPEG="$(command -v ffmpeg)"
    FFPROBE="$(command -v ffprobe)"
  else
    echo "Error: ffmpeg/ffprobe not found. Run install.sh first." >&2
    exit 1
  fi
fi

if [[ -f "$DIR/.venv/bin/activate" ]]; then
  # shellcheck disable=SC1091
  source "$DIR/.venv/bin/activate"
fi
PYTHON="${PYTHON:-python3}"

# --- Parse target ---
target_h=0
target_w_explicit=0
case "$TARGET" in
  4k|4K|2160p) target_h=2160;;
  1440p|2k|2K) target_h=1440;;
  1080p|fhd|FHD) target_h=1080;;
  720p|hd|HD) target_h=720;;
  540p) target_h=540;;
  480p) target_h=480;;
  *x*) target_w_explicit="${TARGET%x*}"; target_h="${TARGET#*x}";;
  *) echo "Error: unrecognized target '$TARGET'" >&2; exit 2;;
esac

# --- Probe input ---
_dims="$("$FFPROBE" -v error -select_streams v:0 \
  -show_entries stream=width,height -of default=nw=1:nk=1 "$INPUT" | tr '\n' ' ')"
read -r in_w in_h <<<"$_dims"
[[ -z "$in_w" || -z "$in_h" ]] && { echo "Error: probe failed" >&2; exit 1; }

# --- Compute target width preserving AR (unless explicit) ---
if [[ "$target_w_explicit" -gt 0 ]]; then
  target_w="$target_w_explicit"
else
  target_w=$(( (in_w * target_h / in_h + 1) / 2 * 2 ))
fi

# --- Already at or above target? Just lanczos to target. ---
if (( in_w >= target_w && in_h >= target_h )); then
  # round to even
  (( target_w % 2 != 0 )) && target_w=$(( target_w + 1 ))
  (( target_h % 2 != 0 )) && target_h=$(( target_h + 1 ))
  if [[ -z "$OUTPUT" ]]; then
    OUTPUT="${INPUT%.*}_smart_${target_w}x${target_h}.mp4"
  fi
  OUTPUT="$(realpath -m "$OUTPUT")"
  echo "Input ${in_w}x${in_h} >= target ${target_w}x${target_h}; lanczos only."
  "$FFMPEG" -y -i "$INPUT" \
    -vf "scale=${target_w}:${target_h}:flags=lanczos" \
    -c:v libx264 -preset medium -crf 18 -pix_fmt yuv420p \
    -c:a aac -movflags +faststart "$OUTPUT"
  echo "Saved: $OUTPUT"
  exit 0
fi

# --- Decide number of ETDS x2 passes (n) ---
# n = largest int with input * 2^n <= target  (i.e. floor(log2(target/input)))
# Use the smaller of the two ratios so neither dim overshoots.
n=0
while (( (in_w * (1 << (n + 1))) <= target_w && (in_h * (1 << (n + 1))) <= target_h )); do
  n=$(( n + 1 ))
  (( n >= 4 )) && break    # cap at 16x
done

scale=$(( 1 << n ))      # 2^n  (1 if n=0)
# Need target divisible by 2^(n+1) so every intermediate stage is even (libx264).
align=$(( scale * 2 ))
target_w=$(( (target_w + align - 1) / align * align ))
target_h=$(( (target_h + align - 1) / align * align ))

mid_w=$(( target_w / scale ))
mid_h=$(( target_h / scale ))

echo "Input:        ${in_w}x${in_h}"
echo "Target:       ${target_w}x${target_h}  ($TARGET)"
echo "ETDS passes:  $n  (each x2)"
echo "Pre-scale:    lanczos -> ${mid_w}x${mid_h}"

# --- Output path ---
if [[ -z "$OUTPUT" ]]; then
  OUTPUT="${INPUT%.*}_smart_${target_w}x${target_h}.mp4"
fi
OUTPUT="$(realpath -m "$OUTPUT")"

TMPDIR_X="$(mktemp -d)"
trap 'rm -rf "$TMPDIR_X"' EXIT

# --- Stage 0: lanczos to mid (or skip if input already matches) ---
stage_file="$TMPDIR_X/stage0.mp4"
cur_w="$mid_w"; cur_h="$mid_h"

if (( in_w == mid_w && in_h == mid_h )); then
  echo "[stage 0] input already at ${mid_w}x${mid_h}, skipping lanczos."
  stage_file="$INPUT"
else
  echo "[stage 0] lanczos ${in_w}x${in_h} -> ${mid_w}x${mid_h}"
  "$FFMPEG" -y -loglevel warning -stats -i "$INPUT" \
    -vf "scale=${mid_w}:${mid_h}:flags=lanczos" \
    -c:v libx264 -preset medium -crf 18 -pix_fmt yuv420p \
    -c:a copy "$stage_file"
fi

# --- Stages 1..n: ETDS x2 ---
for ((i=1; i<=n; i++)); do
  next_w=$(( cur_w * 2 ))
  next_h=$(( cur_h * 2 ))
  if (( i == n )); then
    next_file="$OUTPUT"
  else
    next_file="$TMPDIR_X/stage${i}.mp4"
  fi
  echo "[stage $i] ETDS x2  ${cur_w}x${cur_h} -> ${next_w}x${next_h}"
  "$PYTHON" "$DIR/sr_video_ov.py" "$stage_file" -o "$next_file"
  if (( KEEP_INTERMEDIATE == 1 )) && (( i < n )); then
    keep="${OUTPUT%.*}_stage${i}_${next_w}x${next_h}.mp4"
    cp "$next_file" "$keep"
    echo "Stage $i kept: $keep"
  fi
  stage_file="$next_file"
  cur_w="$next_w"; cur_h="$next_h"
done

if (( KEEP_INTERMEDIATE == 1 )) && [[ -f "$TMPDIR_X/stage0.mp4" ]]; then
  keep="${OUTPUT%.*}_stage0_${mid_w}x${mid_h}.mp4"
  cp "$TMPDIR_X/stage0.mp4" "$keep"
  echo "Stage 0 kept: $keep"
fi

echo "Saved: $OUTPUT"


path: sr_video_ov.py
content: import openvino as ov
import cv2
import numpy as np
import os
import sys
import time
import subprocess
import argparse
import tempfile
import shutil

# ---------------------------
# 项目内置 ffmpeg 路径
# ---------------------------
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
FFMPEG_BIN = os.path.join(SCRIPT_DIR, 'bin', 'ffmpeg')
FFPROBE_BIN = os.path.join(SCRIPT_DIR, 'bin', 'ffprobe')



def get_video_info(video_path):
    """用 ffprobe 获取视频信息"""
    import json
    cmd = [
        FFPROBE_BIN, '-v', 'quiet',
        '-print_format', 'json',
        '-show_streams', '-show_format',
        video_path
    ]
    result = subprocess.run(cmd, capture_output=True, text=True)
    if result.returncode != 0:
        raise RuntimeError(f"ffprobe failed: {result.stderr}")

    info = json.loads(result.stdout)
    video_stream = None
    for stream in info['streams']:
        if stream['codec_type'] == 'video':
            video_stream = stream
            break
    if video_stream is None:
        raise RuntimeError("No video stream found")

    width = int(video_stream['width'])
    height = int(video_stream['height'])
    r_frame_rate = video_stream.get('r_frame_rate', '30/1')
    num, den = map(int, r_frame_rate.split('/'))
    fps = num / den
    has_audio = any(s['codec_type'] == 'audio' for s in info['streams'])
    return width, height, fps, has_audio


def main():
    parser = argparse.ArgumentParser(description='ETDS Video 2x Super-Resolution (OpenVINO)')
    parser.add_argument('input', help='Input video path')
    parser.add_argument('-o', '--output', help='Output video path (default: input_sr2x_ov.mp4)')
    parser.add_argument('--model', default=os.path.join(SCRIPT_DIR, 'model', 'ETDS_M7C48_x2.xml'),
                        help='OpenVINO IR model path (.xml)')
    parser.add_argument('--scale', type=int, default=2, help='Scale factor (default: 2)')
    parser.add_argument('--device', default='CPU', help='OpenVINO device (default: CPU)')
    parser.add_argument('--nthreads', type=int, default=0, help='Number of inference threads (0=auto)')
    args = parser.parse_args()

    input_video = args.input
    if not os.path.isfile(input_video):
        print(f"Error: input video not found: {input_video}")
        sys.exit(1)

    if args.output:
        output_video = args.output
    else:
        base, ext = os.path.splitext(input_video)
        output_video = f"{base}_sr{args.scale}x_ov.mp4"

    if not os.path.isfile(FFMPEG_BIN):
        print(f"Error: ffmpeg not found: {FFMPEG_BIN}")
        sys.exit(1)

    # 获取视频信息
    print(f"Analyzing input: {input_video}")
    width, height, fps, has_audio = get_video_info(input_video)
    out_w, out_h = width * args.scale, height * args.scale
    print(f"Input:  {width}x{height}, {fps:.2f} fps, audio: {'yes' if has_audio else 'no'}")
    print(f"Output: {out_w}x{out_h}")

    # 加载 OpenVINO 模型
    print(f"Loading OpenVINO model: {args.model}")
    core = ov.Core()
    if args.nthreads > 0:
        core.set_property("CPU", {"INFERENCE_NUM_THREADS": args.nthreads})

    model = core.read_model(args.model)
    # 使用固定输入shape以获得最佳性能
    model.reshape({0: [1, 3, height, width]})
    compiled = core.compile_model(model, args.device)
    infer_request = compiled.create_infer_request()
    print(f"Model loaded on {args.device}")

    # Warmup
    dummy = np.random.rand(1, 3, height, width).astype(np.float32)
    infer_request.infer({0: dummy})
    print("Warmup done")

    tmp_dir = tempfile.mkdtemp()
    tmp_video = os.path.join(tmp_dir, 'sr_video_noaudio.mp4')

    try:
        cap = cv2.VideoCapture(input_video)
        total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
        print(f"Total frames: {total_frames}")

        ffmpeg_cmd = [
            FFMPEG_BIN, '-y',
            '-f', 'rawvideo', '-vcodec', 'rawvideo',
            '-s', f'{out_w}x{out_h}',
            '-pix_fmt', 'bgr24', '-r', str(fps),
            '-i', '-',
            '-c:v', 'libx264', '-preset', 'medium',
            '-crf', '18', '-pix_fmt', 'yuv420p',
            tmp_video
        ]
        pipe = subprocess.Popen(ffmpeg_cmd, stdin=subprocess.PIPE, stderr=subprocess.PIPE)

        frame_idx = 0
        total_infer_time = 0
        start_time = time.time()

        while True:
            ret, frame = cap.read()
            if not ret:
                break

            # 预处理: BGR -> RGB -> float32 -> NCHW
            img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB).astype(np.float32) / 255.0
            img_tensor = np.transpose(img, (2, 0, 1))[np.newaxis, ...]

            # OpenVINO 推理
            t0 = time.time()
            infer_request.infer({0: img_tensor})
            result = infer_request.get_output_tensor(0).data.copy()
            t1 = time.time()
            total_infer_time += (t1 - t0)

            # 后处理: NCHW -> HWC -> uint8 -> RGB -> BGR
            output = result.squeeze(0).transpose(1, 2, 0)
            output = np.clip(output, 0, 1) * 255.0
            output = output.astype(np.uint8)
            output = cv2.cvtColor(output, cv2.COLOR_RGB2BGR)

            pipe.stdin.write(output.tobytes())
            frame_idx += 1

            if frame_idx % 10 == 0 or frame_idx == total_frames:
                elapsed = time.time() - start_time
                fps_proc = frame_idx / elapsed if elapsed > 0 else 0
                infer_fps = frame_idx / total_infer_time if total_infer_time > 0 else 0
                print(f"\rProgress: {frame_idx}/{total_frames} "
                      f"({frame_idx * 100 / max(total_frames, 1):.1f}%) "
                      f"total: {fps_proc:.2f} fps, infer: {infer_fps:.2f} fps", end='', flush=True)

        pipe.stdin.close()
        pipe.wait()
        cap.release()
        print()

        total_time = time.time() - start_time
        print(f"Done! {frame_idx} frames in {total_time:.2f}s")
        print(f"  Total pipeline: {frame_idx / total_time:.2f} fps")
        print(f"  Pure inference: {frame_idx / total_infer_time:.2f} fps ({total_infer_time:.2f}s)")
        print(f"  Avg infer/frame: {total_infer_time / frame_idx * 1000:.1f} ms")

        if has_audio:
            print("Merging audio...")
            merge_cmd = [
                FFMPEG_BIN, '-y',
                '-i', tmp_video, '-i', input_video,
                '-c:v', 'copy', '-c:a', 'aac',
                '-map', '0:v:0', '-map', '1:a:0',
                '-shortest', output_video
            ]
            result = subprocess.run(merge_cmd, capture_output=True, text=True)
            if result.returncode != 0:
                print(f"Audio merge warning: {result.stderr}")
                shutil.copy2(tmp_video, output_video)
        else:
            shutil.copy2(tmp_video, output_video)

        print(f"Saved: {output_video}")

    finally:
        shutil.rmtree(tmp_dir, ignore_errors=True)


if __name__ == '__main__':
    main()


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal:  | SkillSpector: suspicious (HIGH)