# 摄像头编码、目标检测和显示

Source: [https://docs.qualcomm.com/doc/80-70022-50SC/topic/camera-encode-file-detection-yolov8-overlay-display.html](https://docs.qualcomm.com/doc/80-70022-50SC/topic/camera-encode-file-detection-yolov8-overlay-display.html)

**gst-camera-two-stream-encode-file-detection-display.py** 应用程序对摄像头流进行编码并将其保存到文件中。该应用程序使用 YOLOX LiteRT 模型从摄像头流中识别场景中的对象。应用程序将边界框覆盖在检测到的目标上并显示结果。

Note: 此应用程序在 Ubuntu Server 上不受支持。

Figure : 用于摄像头编码和目标检测的 pipeline
            
            <!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by Microsoft Visio, SVG Export pipeline_camera_encode_and_objectdetection.svg Layer_2 -->
<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="12.2879in" height="3.71633in" viewbox="0 0 884.727 267.576" 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>Layer_2</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape2-1" v:mid="2" v:groupcontext="shape" transform="translate(0.374959,-0.375114)">		<title>Sheet.2</title>		<path d="M0 261.95 A5.62513 5.62513 -180 0 0 5.62 267.58 L878.35 267.58 A5.62513 5.62513 -180 0 0 883.98 261.95 L883.98					 6.38 A5.62513 5.62513 -180 0 0 878.35 0.75 L5.62 0.75 A5.62513 5.62513 -180 0 0 -0 6.38 L0 261.95 Z" class="st1"></path>	</g>	<g id="shape3-3" v:mid="3" v:groupcontext="shape">		<title>Sheet.3</title>		<path d="M878.73 0.75 C881.62 0.75 883.98 3.11 883.98 6 L883.98 261.58 C883.98 264.47 881.62 266.83 878.73 266.83 L6					 266.83 C3.11 266.83 0.75 264.47 0.75 261.58 L0.75 6 C0.75 3.11 3.11 0.75 6 0.75 L878.73 0.75 ZM878.73 -0					 L6 -0 C2.69 -0 0 2.69 0 6 L0 261.58 C0 264.89 2.69 267.58 6 267.58 L878.73 267.58 C882.04 267.58 884.73					 264.89 884.73 261.58 L884.73 6 C884.73 2.69 882.04 -0 878.73 -0 Z" class="st2"></path>	</g>	<g id="shape6-5" v:mid="6" v:groupcontext="shape" transform="translate(15.2729,-215.076)">		<title>Sheet.6</title>		<desc>camsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st3"></path>		<text x="25.07" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>camsrc</text>		</g>	<g id="shape9-8" v:mid="9" v:groupcontext="shape" transform="translate(124.824,-215.076)">		<title>Sheet.9</title>		<desc>tee</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st3"></path>		<text x="36.68" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>tee</text>		</g>	<g id="shape12-11" v:mid="12" v:groupcontext="shape" transform="translate(115.449,-157.445)">		<title>Sheet.12</title>		<desc>qtimlvconverter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="54.375" cy="248.826" width="108.76" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L105.75 267.58 A3.00007 3.00007 -180 0 0 108.75 264.58 L108.75					 233.08 A3.00007 3.00007 -180 0 0 105.75 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 0 233.08 L0 264.58 Z" class="st5"></path>		<text x="12.77" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlvconverter</text>		</g>	<g id="shape15-14" v:mid="15" v:groupcontext="shape" transform="translate(105.673,-233.826)">		<title>Sheet.15</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape16-17" v:mid="16" v:groupcontext="shape" transform="translate(119.89,-231.208)">		<title>Sheet.16</title>		<path d="M0 267.58 L4.53 264.96 L0 262.34 L0 267.58 Z" class="st7"></path>	</g>	<g id="shape18-19" v:mid="18" v:groupcontext="shape" transform="translate(233.974,-215.076)">		<title>Sheet.18</title>		<desc>qtimetamux</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90.01" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st5"></path>		<text x="12.97" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimetamux</text>		</g>	<g id="shape21-22" v:mid="21" v:groupcontext="shape" transform="translate(214.824,-233.826)">		<title>Sheet.21</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape22-25" v:mid="22" v:groupcontext="shape" transform="translate(229.04,-231.208)">		<title>Sheet.22</title>		<path d="M0 267.58 L4.53 264.96 L0 262.34 L0 267.58 Z" class="st7"></path>	</g>	<g id="shape24-27" v:mid="24" v:groupcontext="shape" transform="translate(343.125,-215.076)">		<title>Sheet.24</title>		<desc>qtioverlay</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90.01" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st5"></path>		<text x="19.08" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtioverlay</text>		</g>	<g id="shape27-30" v:mid="27" v:groupcontext="shape" transform="translate(323.974,-233.826)">		<title>Sheet.27</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape28-33" v:mid="28" v:groupcontext="shape" transform="translate(338.191,-231.208)">		<title>Sheet.28</title>		<path d="M0 267.58 L4.53 264.96 L0 262.34 L0 267.58 Z" class="st7"></path>	</g>	<g id="shape30-35" v:mid="30" v:groupcontext="shape" transform="translate(452.275,-215.076)">		<title>Sheet.30</title>		<desc>v4l2h264enc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st3"></path>		<text x="10.86" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>v4l2h264enc</text>		</g>	<g id="shape33-38" v:mid="33" v:groupcontext="shape" transform="translate(433.125,-233.826)">		<title>Sheet.33</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape34-41" v:mid="34" v:groupcontext="shape" transform="translate(447.341,-231.208)">		<title>Sheet.34</title>		<path d="M0 267.58 L4.53 264.96 L0 262.34 L0 267.58 Z" class="st7"></path>	</g>	<g id="shape36-43" v:mid="36" v:groupcontext="shape" transform="translate(561.426,-215.076)">		<title>Sheet.36</title>		<desc>h264parse</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st3"></path>		<text x="16.65" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>h264parse</text>		</g>	<g id="shape39-46" v:mid="39" v:groupcontext="shape" transform="translate(542.276,-233.826)">		<title>Sheet.39</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape40-49" v:mid="40" v:groupcontext="shape" transform="translate(556.492,-231.208)">		<title>Sheet.40</title>		<path d="M0 267.58 L4.53 264.96 L0 262.34 L0 267.58 Z" class="st7"></path>	</g>	<g id="shape42-51" v:mid="42" v:groupcontext="shape" transform="translate(670.577,-215.076)">		<title>Sheet.42</title>		<desc>mp4mux</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st3"></path>		<text x="21.47" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>mp4mux</text>		</g>	<g id="shape45-54" v:mid="45" v:groupcontext="shape" transform="translate(651.426,-233.826)">		<title>Sheet.45</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape46-57" v:mid="46" v:groupcontext="shape" transform="translate(665.643,-231.208)">		<title>Sheet.46</title>		<path d="M0 267.58 L4.53 264.96 L0 262.34 L0 267.58 Z" class="st7"></path>	</g>	<g id="shape48-59" v:mid="48" v:groupcontext="shape" transform="translate(779.727,-215.076)">		<title>Sheet.48</title>		<desc>filesink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="248.826" width="90.01" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L87 267.58 A3.00007 3.00007 -180 0 0 90 264.58 L90 233.08 A3.00007					 3.00007 -180 0 0 87 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 -0 233.08 L0 264.58 Z" class="st3"></path>		<text x="25.92" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>filesink</text>		</g>	<g id="shape51-62" v:mid="51" v:groupcontext="shape" transform="translate(760.576,-233.826)">		<title>Sheet.51</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape52-65" v:mid="52" v:groupcontext="shape" transform="translate(774.793,-231.208)">		<title>Sheet.52</title>		<path d="M0 267.58 L4.53 264.96 L0 262.34 L0 267.58 Z" class="st7"></path>	</g>	<g id="shape54-67" v:mid="54" v:groupcontext="shape" transform="translate(437.4,52.8461) rotate(90)">		<title>Sheet.54</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape55-70" v:mid="55" v:groupcontext="shape" transform="translate(167.206,-195.98)">		<title>Sheet.55</title>		<path d="M0 263.04 L2.62 267.58 L5.24 263.04 L0 263.04 Z" class="st7"></path>	</g>	<g id="shape57-72" v:mid="57" v:groupcontext="shape" transform="translate(115.449,-99.7433)">		<title>Sheet.57</title>		<desc>qtimltflite</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="54.375" cy="248.826" width="108.75" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L105.75 267.58 A3.00007 3.00007 -180 0 0 108.75 264.58 L108.75					 233.08 A3.00007 3.00007 -180 0 0 105.75 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 0 233.08 L0 264.58 Z" class="st5"></path>		<text x="28.74" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimltflite</text>		</g>	<g id="shape60-75" v:mid="60" v:groupcontext="shape" transform="translate(437.4,110.548) rotate(90)">		<title>Sheet.60</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape61-78" v:mid="61" v:groupcontext="shape" transform="translate(167.206,-138.278)">		<title>Sheet.61</title>		<path d="M0 263.04 L2.62 267.58 L5.24 263.04 L0 263.04 Z" class="st7"></path>	</g>	<g id="shape63-80" v:mid="63" v:groupcontext="shape" transform="translate(115.449,-41.4241)">		<title>Sheet.63</title>		<desc>qtimlpostprocess</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="54.375" cy="248.826" width="108.76" height="37.5"></v:textrect>		<path d="M0 264.58 A3.00007 3.00007 -180 0 0 3 267.58 L105.75 267.58 A3.00007 3.00007 -180 0 0 108.75 264.58 L108.75					 233.08 A3.00007 3.00007 -180 0 0 105.75 230.08 L3 230.08 A3.00007 3.00007 -180 0 0 0 233.08 L0 264.58 Z" class="st5"></path>		<text x="7.67" y="252.43" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlpostprocess</text>		</g>	<g id="shape66-83" v:mid="66" v:groupcontext="shape" transform="translate(437.4,168.867) rotate(90)">		<title>Sheet.66</title>		<path d="M0 267.58 L14.98 267.58" class="st6"></path>	</g>	<g id="shape67-86" v:mid="67" v:groupcontext="shape" transform="translate(167.206,-79.9587)">		<title>Sheet.67</title>		<path d="M0 263.04 L2.62 267.58 L5.24 263.04 L0 263.04 Z" class="st7"></path>	</g>	<g id="shape69-88" v:mid="69" v:groupcontext="shape" transform="translate(224.199,-60.1741)">		<title>Sheet.69</title>		<path d="M0 267.58 L54.78 267.58 L54.78 116.79 L0 267.58 Z" class="st8"></path>		<path d="M0 267.58 L54.78 267.58 L54.78 116.79" class="st6"></path>	</g>	<g id="shape70-91" v:mid="70" v:groupcontext="shape" transform="translate(276.357,-210.196)">		<title>Sheet.70</title>		<path d="M5.24 267.58 L2.62 263.04 L0 267.58 L5.24 267.58 Z" class="st7"></path>	</g>	<g id="group89-93" transform="translate(759.602,-14.7814)" v:mid="89" v:groupcontext="group">		<title>Sheet.89</title>		<g id="shape73-94" v:mid="73" v:groupcontext="shape" transform="translate(15.1883,0)">			<title>Sheet.73</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="26.3891" cy="261.276" width="52.78" height="12.6"></v:textrect>			<rect x="0" y="254.976" width="52.7781" height="12.6" class="st9"></rect>			<text x="-0" y="264.43" class="st10" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Qualcomm  </text>			</g>		<g id="shape74-97" v:mid="74" v:groupcontext="shape" transform="translate(6.29496E-14,-0.218607)">			<title>Sheet.74</title>			<path d="M0 266.08 A1.50003 1.50003 -180 0 0 1.5 267.58 L10.5 267.58 A1.50003 1.50003 -180 0 0 12 266.08 L12 257.08						 A1.50003 1.50003 -180 0 0 10.5 255.58 L1.5 255.58 A1.50003 1.50003 -180 0 0 0 257.08 L0 266.08 Z" class="st5"></path>		</g>		<g id="shape76-99" v:mid="76" v:groupcontext="shape" transform="translate(89.1246,0)">			<title>Sheet.76</title>			<desc>开源</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="10.5" cy="261.276" width="21" height="12.6"></v:textrect>			<rect x="0" y="254.976" width="21" height="12.6" class="st9"></rect>			<text x="0" y="264.77" class="st11" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>开源</text>			</g>		<g id="shape77-102" v:mid="77" v:groupcontext="shape" transform="translate(73.9363,-0.218607)">			<title>Sheet.77</title>			<path d="M0 266.08 A1.50003 1.50003 -180 0 0 1.5 267.58 L10.5 267.58 A1.50003 1.50003 -180 0 0 12 266.08 L12 257.08						 A1.50003 1.50003 -180 0 0 10.5 255.58 L1.5 255.58 A1.50003 1.50003 -180 0 0 0 257.08 L0 266.08 Z" class="st3"></path>		</g>	</g></g>
</svg>

有关该 pipeline 中使用的插件的信息，请参见 [Pipeline 流](https://docs.qualcomm.com/doc/80-70022-50SC/topic/camera-encode-file-detection-yolov8-overlay-display.html#camera-encode-file-detection-yolov8-overlay-display__section_mty_hyk_bdc)。

## 在目标设备上运行应用程序

1. 确保您已完成[前提条件](https://docs.qualcomm.com/doc/80-70022-50SC/topic/prerequisites-for-python-sample-applications.html)。
2. 在目标设备上运行摄像头编码和目标检测脚本：

        gst-camera-two-stream-encode-file-detection-display.pyCopy to clipboard
3. 如需显示可用的帮助选项，可运行以下命令：

        gst-camera-two-stream-encode-file-detection-display.py -hCopy to clipboard

以下是 Python 脚本中的默认文件：

Table : gst-camera-two-stream-encode-file-detection-display.py 的默认模型和标签文件

| 文件 | 目录 |
| :--- | :--- |
| 检测模型（YOLOv8） | /etc/models/yolox\_quantized.tflite |
| 检测标签（两种模型相同） | /etc/labels/yolox.json |

## 预期输出

输出保存在 /etc/media/test.mp4中。

## Pipeline 流

| 处理过程 | 说明 |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtiqmmfsrc.html) | 从摄像头采集两个视频流：<ul class="ul" id="camera-encode-file-detection-yolov8-overlay-display__ul_wcz_11l_bdc"><br>                                    <li class="li">将一个流保存至文件中。</li><br><br>                                    <li class="li">第二个流用于检测。使用 tee 将其进行分割并发送至以下位置：<ul class="ul" id="camera-encode-file-detection-yolov8-overlay-display__ul_nsj_htk_bdc"><br>                                            <li class="li">qtimetamux 保留视频流。</li><br><br>                                            <li class="li">qtimlvconverter 将视频流转换为输入张量，用于分类推理。 </li><br><br>                                        </ul><br></li><br><br>                                </ul> |
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/v4l2h264enc.html) | 编码 H.264 视频。 |
| h264parse | 渲染 H.264 视频。 |
| mp4mux | 多路复用视频数据。 |
| filesink | 将视频数据保存至文件。 |
| **预处理** | **预处理** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimlvconverter.html) | <ol class="ol" id="camera-encode-file-detection-yolov8-overlay-display__ol_i5w_4wl_vbc"><br>                                    <li class="li">在其接收端口上接收视频流。</li><br><br>                                    <li class="li">执行预处理：<ul class="ul" id="camera-encode-file-detection-yolov8-overlay-display__ol_zdw_qwl_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="camera-encode-file-detection-yolov8-overlay-display__ol_u1l_cxl_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="camera-encode-file-detection-yolov8-overlay-display__ol_ky5_grn_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 执行以下操作：<br>                                            </p><ol class="ol" type="a" id="camera-encode-file-detection-yolov8-overlay-display__ol_jcd_wnk_5bc"><br>                                            <li class="li">加载 YOLOv8 子模块。</li><br><br>                                            <li class="li">将结果生成为文本结构。</li><br><br>                                            <li class="li">接着发送到 qtimetamux 的接收端口。</li><br><br>                                        </ol><br></li><br><br>                                </ol> |
| [qtimetamux](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimetamux.html) | <ol class="ol" id="camera-encode-file-detection-yolov8-overlay-display__ol_ll3_x5l_vbc"><br>                                    <li class="li">在接收端口上接收视频流和文本流，以及与视频流相对应的边框结果。</li><br><br>                                    <li class="li">使用接收端口中的视频流内容生成 GST 缓存。</li><br><br>                                    <li class="li">将边框作为 GstVideoRegionOfInterest 从数据接收端添加到其发送端口上的 GST 缓存元数据（元复用）。</li><br><br>                                </ol> |
| [qtivoverlay](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtioverlay.html) | <ol class="ol" id="camera-encode-file-detection-yolov8-overlay-display__ol_wst_y5l_vbc"><br>                                    <li class="li">接收多路复用流。</li><br><br>                                    <li class="li">使用 CL 将边框叠加在 VideoFrame 上。</li><br><br>                                    <li class="li">在其发送端口上生成带有叠加层的 GST 缓存。</li><br><br>                                </ol> |
| **输出** | **输出** |
| [Waylandsink](https://docs.qualcomm.com/doc/80-70022-50SC/topic/waylandsink.html) | <ol class="ol" id="camera-encode-file-detection-yolov8-overlay-display__ol_cgt_mwl_vbc"><br>                                    <li class="li">在其接收端口上接收视频</li><br><br>                                    <li class="li">将视频流提交到 Weston。 </li><br><br>                                    <li class="li">Weston 在本地显示器设备上呈现视频流。</li><br><br>                                </ol> |

## 相关信息

[目标检测](https://docs.qualcomm.com/doc/80-70022-50SC/topic/gst-ai-object-detection.html)

**Parent Topic:** [运行基于 Python 的应用程序](https://docs.qualcomm.com/doc/80-70022-50SC/topic/python-sample-applications.html)

Last Published: Nov 05, 2025

[Previous Topic
转换和编码摄像头流](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/camera-transform-downscale-and-rotate-encode.md) [Next Topic
目标检测、分类和分割](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/object-detection-classification-and-segmentation-python-sample-app.md)