# 使用 LiteRT 进行图像分割和编码

Source: [https://docs.qualcomm.com/doc/80-70022-50SC/topic/single-camera-stream-with-image-segmentation-and-encode.html](https://docs.qualcomm.com/doc/80-70022-50SC/topic/single-camera-stream-with-image-segmentation-and-encode.html)

该用例实现了 `deeplabv3_resnet50` LiteRT 模型来组合语义分割和原始视频流，对该视频流进行编码，然后将其复用到一个 MP4 容器中。

Note: 对于 Ubuntu Server，需要 `sudo` 访问权限才能将编码流写入 `/etc/media` 文件夹。

在目标设备上运行用例：

    gst-launch-1.0 -e --gst-debug=2 \
    qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12_Q08C,width=1280,height=720,framerate=30/1 ! queue ! tee name=split \
    split. ! queue ! qtivcomposer name=mixer sink_1::dimensions="<1920,1080>" sink_1::alpha=0.5 ! queue ! \
    video/x-raw,format=NV12,width=1920,height=1080,interlace-mode=progressive,colorimetry=bt601 ! \
    v4l2h264enc capture-io-mode=4 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/etc/media/video.mp4 \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
    external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/deeplabv3_plus_mobilenet_quantized.tflite ! queue ! \
    qtimlpostprocess module=deeplab-argmax labels=/etc/labels/deeplabv3_resnet50.json ! video/x-raw,width=256,height=144 ! queue ! mixer.Copy to clipboard

要停止用例，请使用 CTRL + C。

下图显示了用例执行的流程：

1. 从通过摄像头源的视频流中识别场景。
2. 使用 qtivcomposer 组成语义分割和视频流。
3. 将流编码为 H.264 码流并在 MP4 容器中多路复用该流。

Figure : 使用 qtivcomposer 进行分段和编码的 pipeline
            
            <!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by Microsoft Visio, SVG Export pipeline_segmentation_and_encode_with_qtivcomposer.svg pipeline_segmentation_and_encod -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="10.9785in" height="3.70349in" viewbox="0 0 790.451 266.652" xml:space="preserve" color-interpolation-filters="sRGB" class="st12"><v:documentproperties v:langid="1033" v:viewmarkup="false"></v:documentproperties>
<style>.svg-1 .st1 { fill: #fafafa; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st2 { fill: #d2d7e1; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st3 { fill: #007884; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st4 { fill: #ffffff; font-family: Roboto; font-size: 1.00001em }
.svg-1 .st5 { fill: #2a2aea; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st6 { stroke: #000000; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st7 { fill: #000000; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st8 { fill: none }
.svg-1 .st9 { fill: none; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st10 { fill: #000000; font-family: Roboto; font-size: 0.874992em }
.svg-1 .st11 { fill: #000000; font-family: SimHei; font-size: 0.874992em }
.svg-1 .st12 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<g v:mid="0" v:index="1" v:groupcontext="foregroundPage">	<title>pipeline_segmentation_and_encod</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape3-1" v:mid="3" v:groupcontext="shape" transform="translate(0.3752,-0.375275)">		<title>Sheet.3</title>		<path d="M0 261.03 A5.62513 5.62513 -180 0 0 5.62 266.65 L784.08 266.65 A5.62513 5.62513 -180 0 0 789.7 261.03 L789.7					 6.38 A5.62513 5.62513 -180 0 0 784.08 0.75 L5.62 0.75 A5.62513 5.62513 -180 0 0 0 6.38 L0 261.03 Z" class="st1"></path>	</g>	<g id="shape4-3" v:mid="4" v:groupcontext="shape">		<title>Sheet.4</title>		<path d="M784.45 0.75 C787.35 0.75 789.7 3.11 789.7 6 L789.7 260.65 C789.7 263.55 787.35 265.9 784.45 265.9 L6 265.9					 C3.11 265.9 0.75 263.55 0.75 260.65 L0.75 6 C0.75 3.11 3.11 0.75 6 0.75 L784.45 0.75 ZM784.45 0 L6 0 C2.69					 0 0 2.69 0 6 L0 260.65 C0 263.97 2.69 266.65 6 266.65 L784.45 266.65 C787.76 266.65 790.45 263.97 790.45					 260.65 L790.45 6 C790.45 2.69 787.76 0 784.45 0 Z" class="st2"></path>	</g>	<g id="shape14-5" v:mid="14" v:groupcontext="shape" transform="translate(15,-214.152)">		<title>Sheet.14</title>		<desc>camsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="247.902" width="90" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L87 266.65 A3.00007 3.00007 -180 0 0 90 263.65 L90 232.15 A3.00007					 3.00007 -180 0 0 87 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 -0 232.15 L0 263.65 Z" class="st3"></path>		<text x="25.07" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>camsrc</text>		</g>	<g id="shape17-8" v:mid="17" v:groupcontext="shape" transform="translate(124.551,-214.152)">		<title>Sheet.17</title>		<desc>tee</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="247.902" width="90" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L87 266.65 A3.00007 3.00007 -180 0 0 90 263.65 L90 232.15 A3.00007					 3.00007 -180 0 0 87 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 -0 232.15 L0 263.65 Z" class="st3"></path>		<text x="36.68" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>tee</text>		</g>	<g id="shape20-11" v:mid="20" v:groupcontext="shape" transform="translate(109.551,-156.521)">		<title>Sheet.20</title>		<desc>qtimlvconverter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="247.902" width="120" height="37.5"></v:textrect>		<path d="M-0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L117 266.65 A3.00007 3.00007 -180 0 0 120 263.65 L120 232.15 A3.00007					 3.00007 -180 0 0 117 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 0 232.15 L0 263.65 Z" class="st5"></path>		<text x="18.39" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlvconverter</text>		</g>	<g id="shape23-14" v:mid="23" v:groupcontext="shape" transform="translate(105.401,-232.902)">		<title>Sheet.23</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape24-17" v:mid="24" v:groupcontext="shape" transform="translate(119.617,-230.284)">		<title>Sheet.24</title>		<path d="M0 266.65 L4.53 264.03 L0 261.42 L0 266.65 Z" class="st7"></path>	</g>	<g id="shape26-19" v:mid="26" v:groupcontext="shape" transform="translate(234.049,-214.152)">		<title>Sheet.26</title>		<desc>qtivcomposer</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="52.5" cy="247.902" width="105" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L102 266.65 A3.00007 3.00007 -180 0 0 105 263.65 L105 232.15 A3.00007					 3.00007 -180 0 0 102 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 -0 232.15 L0 263.65 Z" class="st5"></path>		<text x="15.85" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtivcomposer</text>		</g>	<g id="shape29-22" v:mid="29" v:groupcontext="shape" transform="translate(214.551,-232.902)">		<title>Sheet.29</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape30-25" v:mid="30" v:groupcontext="shape" transform="translate(228.768,-230.284)">		<title>Sheet.30</title>		<path d="M0 266.65 L4.53 264.03 L0 261.42 L0 266.65 Z" class="st7"></path>	</g>	<g id="shape32-27" v:mid="32" v:groupcontext="shape" transform="translate(339.049,-232.902)">		<title>Sheet.32</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape33-30" v:mid="33" v:groupcontext="shape" transform="translate(353.265,-230.284)">		<title>Sheet.33</title>		<path d="M0 266.65 L4.53 264.03 L0 261.42 L0 266.65 Z" class="st7"></path>	</g>	<g id="shape35-32" v:mid="35" v:groupcontext="shape" transform="translate(357.999,-214.152)">		<title>Sheet.35</title>		<desc>v4l2h264enc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="247.902" width="90" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L87 266.65 A3.00007 3.00007 -180 0 0 90 263.65 L90 232.15 A3.00007					 3.00007 -180 0 0 87 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 0 232.15 L0 263.65 Z" class="st3"></path>		<text x="10.86" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>v4l2h264enc</text>		</g>	<g id="shape38-35" v:mid="38" v:groupcontext="shape" transform="translate(467.15,-214.152)">		<title>Sheet.38</title>		<desc>h264parse</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="247.902" width="90.01" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L87 266.65 A3.00007 3.00007 -180 0 0 90 263.65 L90 232.15 A3.00007					 3.00007 -180 0 0 87 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 -0 232.15 L0 263.65 Z" class="st3"></path>		<text x="16.65" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>h264parse</text>		</g>	<g id="shape41-38" v:mid="41" v:groupcontext="shape" transform="translate(447.999,-232.902)">		<title>Sheet.41</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape42-41" v:mid="42" v:groupcontext="shape" transform="translate(462.215,-230.284)">		<title>Sheet.42</title>		<path d="M0 266.65 L4.53 264.03 L0 261.42 L0 266.65 Z" class="st7"></path>	</g>	<g id="shape44-43" v:mid="44" v:groupcontext="shape" transform="translate(576.3,-214.152)">		<title>Sheet.44</title>		<desc>mp4mux</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="247.902" width="90" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L87 266.65 A3.00007 3.00007 -180 0 0 90 263.65 L90 232.15 A3.00007					 3.00007 -180 0 0 87 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 -0 232.15 L0 263.65 Z" class="st3"></path>		<text x="21.47" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>mp4mux</text>		</g>	<g id="shape47-46" v:mid="47" v:groupcontext="shape" transform="translate(557.149,-232.902)">		<title>Sheet.47</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape48-49" v:mid="48" v:groupcontext="shape" transform="translate(571.366,-230.284)">		<title>Sheet.48</title>		<path d="M0 266.65 L4.53 264.03 L0 261.42 L0 266.65 Z" class="st7"></path>	</g>	<g id="shape50-51" v:mid="50" v:groupcontext="shape" transform="translate(685.451,-214.152)">		<title>Sheet.50</title>		<desc>filesink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="247.902" width="90.01" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L87 266.65 A3.00007 3.00007 -180 0 0 90 263.65 L90 232.15 A3.00007					 3.00007 -180 0 0 87 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 -0 232.15 L0 263.65 Z" class="st3"></path>		<text x="25.92" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>filesink</text>		</g>	<g id="shape53-54" v:mid="53" v:groupcontext="shape" transform="translate(666.3,-232.902)">		<title>Sheet.53</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape54-57" v:mid="54" v:groupcontext="shape" transform="translate(680.517,-230.284)">		<title>Sheet.54</title>		<path d="M0 266.65 L4.53 264.03 L0 261.42 L0 266.65 Z" class="st7"></path>	</g>	<g id="shape56-59" v:mid="56" v:groupcontext="shape" transform="translate(436.203,52.8461) rotate(90)">		<title>Sheet.56</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape57-62" v:mid="57" v:groupcontext="shape" transform="translate(166.933,-195.055)">		<title>Sheet.57</title>		<path d="M0 262.12 L2.62 266.65 L5.24 262.12 L0 262.12 Z" class="st7"></path>	</g>	<g id="shape59-64" v:mid="59" v:groupcontext="shape" transform="translate(109.551,-98.8192)">		<title>Sheet.59</title>		<desc>qtimltflite</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="247.902" width="120" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L117 266.65 A3.00007 3.00007 -180 0 0 120 263.65 L120 232.15 A3.00007					 3.00007 -180 0 0 117 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 0 232.15 L0 263.65 Z" class="st5"></path>		<text x="34.36" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimltflite</text>		</g>	<g id="shape62-67" v:mid="62" v:groupcontext="shape" transform="translate(436.203,110.548) rotate(90)">		<title>Sheet.62</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape63-70" v:mid="63" v:groupcontext="shape" transform="translate(166.933,-137.354)">		<title>Sheet.63</title>		<path d="M0 262.12 L2.62 266.65 L5.24 262.12 L0 262.12 Z" class="st7"></path>	</g>	<g id="shape65-72" v:mid="65" v:groupcontext="shape" transform="translate(109.551,-42)">		<title>Sheet.65</title>		<desc>qtimlpostprocess</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="247.902" width="120" height="37.5"></v:textrect>		<path d="M0 263.65 A3.00007 3.00007 -180 0 0 3 266.65 L117 266.65 A3.00007 3.00007 -180 0 0 120 263.65 L120 232.15 A3.00007					 3.00007 -180 0 0 117 229.15 L3 229.15 A3.00007 3.00007 -180 0 0 0 232.15 L0 263.65 Z" class="st5"></path>		<text x="13.29" y="251.5" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlpostprocess</text>		</g>	<g id="shape68-75" v:mid="68" v:groupcontext="shape" transform="translate(436.203,167.832) rotate(90)">		<title>Sheet.68</title>		<path d="M0 266.65 L14.98 266.65" class="st6"></path>	</g>	<g id="shape69-78" v:mid="69" v:groupcontext="shape" transform="translate(166.933,-80.0692)">		<title>Sheet.69</title>		<path d="M0 262.12 L2.62 266.65 L5.24 262.12 L0 262.12 Z" class="st7"></path>	</g>	<g id="shape71-80" v:mid="71" v:groupcontext="shape" transform="translate(229.551,-60.75)">		<title>Sheet.71</title>		<path d="M0 266.65 L57 266.65 L57 117.36 L0 266.65 Z" class="st8"></path>		<path d="M0 266.65 L57 266.65 L57 117.36" class="st6"></path>	</g>	<g id="shape72-83" v:mid="72" v:groupcontext="shape" transform="translate(283.931,-209.272)">		<title>Sheet.72</title>		<path d="M5.24 266.65 L2.62 262.12 L0 266.65 L5.24 266.65 Z" class="st7"></path>	</g>	<g id="group73-85" transform="translate(665.326,-14.7814)" v:mid="73" v:groupcontext="group">		<title>Sheet.73</title>		<g id="shape7-86" v:mid="7" v:groupcontext="shape" transform="translate(15.1883,0)">			<title>Sheet.7</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="47.25" cy="260.352" width="94.51" height="12.6"></v:textrect>			<rect x="0" y="254.052" width="94.5" height="12.6" class="st9"></rect>			<text x="0" y="263.5" class="st10" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Qualcomm  </text>			</g>		<g id="shape8-89" v:mid="8" v:groupcontext="shape" transform="translate(6.29496E-14,-0.218607)">			<title>Sheet.8</title>			<path d="M0 265.15 A1.50003 1.50003 -180 0 0 1.5 266.65 L10.5 266.65 A1.50003 1.50003 -180 0 0 12 265.15 L12 256.15						 A1.50003 1.50003 -180 0 0 10.5 254.65 L1.5 254.65 A1.50003 1.50003 -180 0 0 -0 256.15 L0 265.15 Z" class="st5"></path>		</g>		<g id="shape10-91" v:mid="10" v:groupcontext="shape" transform="translate(89.1246,0)">			<title>Sheet.10</title>			<desc>开源</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="10.5" cy="260.352" width="21.01" height="12.6"></v:textrect>			<rect x="0" y="254.052" width="21" height="12.6" class="st9"></rect>			<text x="0" y="263.85" class="st11" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>开源</text>			</g>		<g id="shape11-94" v:mid="11" v:groupcontext="shape" transform="translate(73.9363,-0.218607)">			<title>Sheet.11</title>			<path d="M0 265.15 A1.50003 1.50003 -180 0 0 1.5 266.65 L10.5 266.65 A1.50003 1.50003 -180 0 0 12 265.15 L12 256.15						 A1.50003 1.50003 -180 0 0 10.5 254.65 L1.5 254.65 A1.50003 1.50003 -180 0 0 -0 256.15 L0 265.15 Z" class="st3"></path>		</g>	</g></g>
</svg>

下表列出了 pipeline 执行的顺序处理阶段：

| 处理过程 | 说明 |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtiqmmfsrc.html) | <ol class="ol" id="single-camera-stream-with-image-segmentation-and-encode__ol_f5k_g5n_vbc"><br>                                <li class="li">采集视频流（源）并创建源的两个副本：<ul class="ul" id="single-camera-stream-with-image-segmentation-and-encode__ul_n44_nwl_vbc"><br>                                        <li class="li">一个视频流被发送到 qtivcomposer 插件以保留视频流。</li><br><br>                                        <li class="li">另一个流被发送到 pipeline 中的 ML 推理分支。</li><br><br>                                    </ul><br></li><br><br>                            </ol> |
| **预处理** | **预处理** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimlvconverter.html) | <ol class="ol" id="single-camera-stream-with-image-segmentation-and-encode__ol_xsf_q5l_vbc"><br>                                <li class="li">在其接收端口上接收视频流。</li><br><br>                                <li class="li">执行预处理：<ul class="ul" id="single-camera-stream-with-image-segmentation-and-encode__ul_ff2_twl_vbc"><br>                                        <li class="li">颜色转换</li><br><br>                                        <li class="li">缩小/放大</li><br><br>                                        <li class="li">当模型期望浮点值作为输入时对流数据进行标准化</li><br><br>                                    </ul><br></li><br><br>                                <li class="li">在其发送端口上将视频流转换为张量数据。<p class="p">分割模型使用此张量数据进行推理。</p><br></li><br><br>                            </ol> |
| **推理** | **推理** |
| [qtimltflite](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimltflite.html) | <ol class="ol" id="single-camera-stream-with-image-segmentation-and-encode__ol_lfr_35n_vbc"><br>                                <li class="li">加载分割模型。</li><br><br>                                <li class="li">为选择的 delegate 修改图。</li><br><br>                                <li class="li">在其接收端口上接收张量数据。</li><br><br>                                <li class="li">运行推理并在其发送端口上生成包含分割结果的张量数据。</li><br><br>                            </ol> |
| **后处理** | **后处理** |
| qtimlpostprocess | <ol class="ol" id="single-camera-stream-with-image-segmentation-and-encode__ol_mtr_k5n_vbc"><br>                                <li class="li">在其接收端口上接收推理张量。</li><br><br>                                <li class="li">将推理张量转换为多媒体插件稍后可以处理的视频格式。</li><br><br>                                <li class="li">生成帧的语义分割。</li><br><br>                                <li class="li">加载分割模型的相应模块。<p class="p">在此用例中，qtimlpostprocess 执行以下操作： </p><ol class="ol" type="a" id="single-camera-stream-with-image-segmentation-and-encode__ol_ntr_k5n_vbc"><br>                                        <li class="li">加载 deeplab-argmax 子模块。</li><br><br>                                        <li class="li">生成带有分割遮罩的视频帧。</li><br><br>                                        <li class="li">将它们发送至 qtivcomposer 的接收端口。</li><br><br>                                    </ol><br><br>                                </li><br><br>                            </ol> |
| [qtivcomposer](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtivcomposer.html) | <ol class="ol" id="single-camera-stream-with-image-segmentation-and-encode__ol_nmc_lxl_vbc"><br>                                <li class="li">在其接收端口上接收带有分割遮罩的原始视频流。 </li><br><br>                                <li class="li">在其发送端口上生成 GST 缓存，其内容由来自其接收端口的视频流组成。</li><br><br>                            </ol> |
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/v4l2h264enc.html) | <ol class="ol" id="single-camera-stream-with-image-segmentation-and-encode__ol_wsc_bsn_vbc"><br>                                <li class="li">将参数应用于在接收端口上接收到的视频流的每一帧。</li><br><br>                                <li class="li">将其编码为码流，并通过其发送端口发送。</li><br><br>                            </ol> |
| h264parse | 向 GStreamer 缓存元数据添加更多比特流信息。 |
| mp4mux | 接收这些缓存并创建具有格式规范缓存的容器。 |
| **输出** | **输出** |
| Filesink | 将生成的数据流存储在 /etc/media/video.mp4文件中。 |
| Playback | 从主机拉取 video.mp4并在媒体播放器上播放：<br>`scp root@<IP address of target<br>                                    device>:/etc/media/video.mp4 <destination<br>                                directory>` |

**Parent Topic:** [LiteRT 用例](https://docs.qualcomm.com/doc/80-70022-50SC/topic/tensorflow-lite-use-cases.html)

Last Published: Nov 05, 2025

[Previous Topic
使用 LiteRT 进行图像分割和显示](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/single-camera-stream-with-image-segmentation-and-display.md) [Next Topic
使用 LiteRT 进行姿态估计和显示](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/single-camera-stream-with-pose-estimation-and-display.md)