# 使用 Neural Processing SDK 进行图像分割和编码

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

该用例使用 Qualcomm Neural Processing SDK runtime 实现了 DeepLab v3 模型。该用例将语义分割与原始视频流进行合成，对该流进行编码，然后将其复用到一个 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=1920,height=1080,framerate=30/1 ! queue ! tee name=split  \
    split. ! queue ! qtivcomposer name=mixer sink_1::dimensions="<1920,1080>" sink_1::alpha=0.5 ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! \
    h264parse ! queue ! mp4mux ! queue ! filesink location=/etc/media/video.mp4 \
    split. ! queue ! qtimlvconverter ! queue ! qtimlsnpe delegate=dsp model=/etc/models/deeplabv3_resnet50.dlc ! queue ! \
    qtimlpostprocess module=deeplab-argmax labels=/etc/labels/deeplabv3_resnet50.json ! video/x-raw,width=640,height=360 ! 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_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.72433in" viewbox="0 0 790.451 268.152" 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 262.53 A5.62513 5.62513 -180 0 0 5.62 268.15 L784.08 268.15 A5.62513 5.62513 -180 0 0 789.7 262.53 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 262.53 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 262.15 C789.7 265.05 787.35 267.4 784.45 267.4 L6 267.4					 C3.11 267.4 0.75 265.05 0.75 262.15 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 262.15 C0 265.47 2.69 268.15 6 268.15 L784.45 268.15 C787.76 268.15 790.45 265.47 790.45					 262.15 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,-215.652)">		<title>Sheet.14</title>		<desc>camsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="249.402" width="90" height="37.5"></v:textrect>		<path d="M0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L87 268.15 A3.00007 3.00007 -180 0 0 90 265.15 L90 233.65 A3.00007					 3.00007 -180 0 0 87 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 -0 233.65 L0 265.15 Z" class="st3"></path>		<text x="25.07" y="253" 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,-215.652)">		<title>Sheet.17</title>		<desc>tee</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="249.402" width="90" height="37.5"></v:textrect>		<path d="M0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L87 268.15 A3.00007 3.00007 -180 0 0 90 265.15 L90 233.65 A3.00007					 3.00007 -180 0 0 87 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 -0 233.65 L0 265.15 Z" class="st3"></path>		<text x="36.68" y="253" 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,-158.021)">		<title>Sheet.20</title>		<desc>qtimlvconverter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="249.402" width="120" height="37.5"></v:textrect>		<path d="M-0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L117 268.15 A3.00007 3.00007 -180 0 0 120 265.15 L120 233.65 A3.00007					 3.00007 -180 0 0 117 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 0 233.65 L0 265.15 Z" class="st5"></path>		<text x="18.39" y="253" 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,-234.402)">		<title>Sheet.23</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape24-17" v:mid="24" v:groupcontext="shape" transform="translate(119.617,-231.784)">		<title>Sheet.24</title>		<path d="M0 268.15 L4.53 265.53 L0 262.92 L0 268.15 Z" class="st7"></path>	</g>	<g id="shape26-19" v:mid="26" v:groupcontext="shape" transform="translate(234.049,-215.652)">		<title>Sheet.26</title>		<desc>qtivcomposer</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="52.5" cy="249.402" width="105" height="37.5"></v:textrect>		<path d="M-0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L102 268.15 A3.00007 3.00007 -180 0 0 105 265.15 L105 233.65 A3.00007					 3.00007 -180 0 0 102 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 -0 233.65 L0 265.15 Z" class="st5"></path>		<text x="15.85" y="253" 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,-234.402)">		<title>Sheet.29</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape30-25" v:mid="30" v:groupcontext="shape" transform="translate(228.768,-231.784)">		<title>Sheet.30</title>		<path d="M0 268.15 L4.53 265.53 L0 262.92 L0 268.15 Z" class="st7"></path>	</g>	<g id="shape32-27" v:mid="32" v:groupcontext="shape" transform="translate(339.049,-234.402)">		<title>Sheet.32</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape33-30" v:mid="33" v:groupcontext="shape" transform="translate(353.265,-231.784)">		<title>Sheet.33</title>		<path d="M0 268.15 L4.53 265.53 L0 262.92 L0 268.15 Z" class="st7"></path>	</g>	<g id="shape35-32" v:mid="35" v:groupcontext="shape" transform="translate(357.999,-215.652)">		<title>Sheet.35</title>		<desc>v4l2h264enc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="249.402" width="90" height="37.5"></v:textrect>		<path d="M0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L87 268.15 A3.00007 3.00007 -180 0 0 90 265.15 L90 233.65 A3.00007					 3.00007 -180 0 0 87 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 -0 233.65 L0 265.15 Z" class="st3"></path>		<text x="10.86" y="253" 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,-215.652)">		<title>Sheet.38</title>		<desc>h264parse</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="249.402" width="90.01" height="37.5"></v:textrect>		<path d="M0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L87 268.15 A3.00007 3.00007 -180 0 0 90 265.15 L90 233.65 A3.00007					 3.00007 -180 0 0 87 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 -0 233.65 L0 265.15 Z" class="st3"></path>		<text x="16.65" y="253" 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,-234.402)">		<title>Sheet.41</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape42-41" v:mid="42" v:groupcontext="shape" transform="translate(462.215,-231.784)">		<title>Sheet.42</title>		<path d="M0 268.15 L4.53 265.53 L0 262.92 L0 268.15 Z" class="st7"></path>	</g>	<g id="shape44-43" v:mid="44" v:groupcontext="shape" transform="translate(576.3,-215.652)">		<title>Sheet.44</title>		<desc>mp4mux</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="249.402" width="90" height="37.5"></v:textrect>		<path d="M0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L87 268.15 A3.00007 3.00007 -180 0 0 90 265.15 L90 233.65 A3.00007					 3.00007 -180 0 0 87 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 -0 233.65 L0 265.15 Z" class="st3"></path>		<text x="21.47" y="253" 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,-234.402)">		<title>Sheet.47</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape48-49" v:mid="48" v:groupcontext="shape" transform="translate(571.366,-231.784)">		<title>Sheet.48</title>		<path d="M0 268.15 L4.53 265.53 L0 262.92 L0 268.15 Z" class="st7"></path>	</g>	<g id="shape50-51" v:mid="50" v:groupcontext="shape" transform="translate(685.451,-215.652)">		<title>Sheet.50</title>		<desc>filesink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="249.402" width="90.01" height="37.5"></v:textrect>		<path d="M-0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L87 268.15 A3.00007 3.00007 -180 0 0 90 265.15 L90 233.65 A3.00007					 3.00007 -180 0 0 87 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 -0 233.65 L0 265.15 Z" class="st3"></path>		<text x="25.92" y="253" 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,-234.402)">		<title>Sheet.53</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape54-57" v:mid="54" v:groupcontext="shape" transform="translate(680.517,-231.784)">		<title>Sheet.54</title>		<path d="M0 268.15 L4.53 265.53 L0 262.92 L0 268.15 Z" class="st7"></path>	</g>	<g id="shape56-59" v:mid="56" v:groupcontext="shape" transform="translate(437.703,52.8461) rotate(90)">		<title>Sheet.56</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape57-62" v:mid="57" v:groupcontext="shape" transform="translate(166.933,-196.555)">		<title>Sheet.57</title>		<path d="M0 263.62 L2.62 268.15 L5.24 263.62 L0 263.62 Z" class="st7"></path>	</g>	<g id="shape59-64" v:mid="59" v:groupcontext="shape" transform="translate(109.551,-100.319)">		<title>Sheet.59</title>		<desc>qtimlsnpe</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="249.402" width="120.01" height="37.5"></v:textrect>		<path d="M0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L117 268.15 A3.00007 3.00007 -180 0 0 120 265.15 L120 233.65 A3.00007					 3.00007 -180 0 0 117 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 0 233.65 L0 265.15 Z" class="st5"></path>		<text x="33.51" y="253" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlsnpe</text>		</g>	<g id="shape62-67" v:mid="62" v:groupcontext="shape" transform="translate(437.703,110.548) rotate(90)">		<title>Sheet.62</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape63-70" v:mid="63" v:groupcontext="shape" transform="translate(166.933,-138.854)">		<title>Sheet.63</title>		<path d="M0 263.62 L2.62 268.15 L5.24 263.62 L0 263.62 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="249.402" width="120.01" height="37.5"></v:textrect>		<path d="M0 265.15 A3.00007 3.00007 -180 0 0 3 268.15 L117 268.15 A3.00007 3.00007 -180 0 0 120 265.15 L120 233.65 A3.00007					 3.00007 -180 0 0 117 230.65 L3 230.65 A3.00007 3.00007 -180 0 0 0 233.65 L0 265.15 Z" class="st5"></path>		<text x="13.29" y="253" 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(437.703,168.867) rotate(90)">		<title>Sheet.68</title>		<path d="M0 268.15 L14.98 268.15" class="st6"></path>	</g>	<g id="shape69-78" v:mid="69" v:groupcontext="shape" transform="translate(166.933,-80.5346)">		<title>Sheet.69</title>		<path d="M0 263.62 L2.62 268.15 L5.24 263.62 L0 263.62 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 268.15 L49.15 268.15 L49.15 117.36 L0 268.15 Z" class="st8"></path>		<path d="M0 268.15 L49.15 268.15 L49.15 117.36" class="st6"></path>	</g>	<g id="shape72-83" v:mid="72" v:groupcontext="shape" transform="translate(276.084,-210.772)">		<title>Sheet.72</title>		<path d="M5.24 268.15 L2.62 263.62 L0 268.15 L5.24 268.15 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.1882,0)">			<title>Sheet.7</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="28.715" cy="261.852" width="57.44" height="12.6"></v:textrect>			<rect x="0" y="255.552" width="57.4301" height="12.6" class="st9"></rect>			<text x="-0" y="265" 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 266.65 A1.50003 1.50003 -180 0 0 1.5 268.15 L10.5 268.15 A1.50003 1.50003 -180 0 0 12 266.65 L12 257.65						 A1.50003 1.50003 -180 0 0 10.5 256.15 L1.5 256.15 A1.50003 1.50003 -180 0 0 0 257.65 L0 266.65 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="261.852" width="21" height="12.6"></v:textrect>			<rect x="0" y="255.552" width="21" height="12.6" class="st9"></rect>			<text x="-0" y="265.35" 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 266.65 A1.50003 1.50003 -180 0 0 1.5 268.15 L10.5 268.15 A1.50003 1.50003 -180 0 0 12 266.65 L12 257.65						 A1.50003 1.50003 -180 0 0 10.5 256.15 L1.5 256.15 A1.50003 1.50003 -180 0 0 0 257.65 L0 266.65 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-with-deeplabv3-quantized__ol_f5k_g5n_vbc"><br>                                <li class="li">采集视频流（源）并创建源的两个副本：<ul class="ul" id="single-camera-stream-with-image-segmentation-and-encode-with-deeplabv3-quantized__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-with-deeplabv3-quantized__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-with-deeplabv3-quantized__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> |
| **推理** | **推理** |
| [qtimlsnpe](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimlsnpe.html) | <ol class="ol" id="single-camera-stream-with-image-segmentation-and-encode-with-deeplabv3-quantized__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-with-deeplabv3-quantized__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-with-deeplabv3-quantized__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-with-deeplabv3-quantized__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-with-deeplabv3-quantized__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:** [Qualcomm Neural Processing SDK 用例](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qualcomm-neural-processing-sdk-use-cases.html)

Last Published: Nov 05, 2025

[Previous Topic
使用 Neural Processing SDK 进行图像分割和显示](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/single-camera-stream-with-image-segmentation-and-display-with-deeplabv3-quantized.md) [Next Topic
运行多媒体用例](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/multimedia-use-cases.md)