python 统计 xml 文件中指定标签类型的个数
xml文件内容
:
<?xml version="1.0" encoding="utf-8"?>
<annotations>
<version>1.1</version>
<meta>
<task>
<id>297</id>
<name>video_extract_4</name>
<size>152</size>
<mode>annotation</mode>
<overlap>0</overlap>
<bugtracker></bugtracker>
<created>2019-12-18 10:05:12.226278+03:00</created>
<updated>2019-12-18 10:36:35.433517+03:00</updated>
<start_frame>0</start_frame>
<stop_frame>0</stop_frame>
<frame_filter></frame_filter>
<labels>
<label>
<name>Head</name>
<attributes>
<attribute>
<name>type</name>
<mutable>False</mutable>
<input_type>select</input_type>
<default_value>Head</default_value>
<values>Head</values>
</attribute>
</attributes>
</label>
</labels>
<segments>
<segment>
<id>546</id>
<start>0</start>
<stop>151</stop>
<url>http://cvat-abed02.kankanai.com.cn:8088/?id=546</url>
</segment>
</segments>
<owner>
<username>xiongxiaolan</username>
<email></email>
</owner>
</task>
<dumped>2019-12-18 12:14:28.189505+03:00</dumped>
</meta>
<image id="0" name="video_extract/4/Real_D_1.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="562.90" ytl="210.53" xbr="628.69" ybr="277.64">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="1" name="video_extract/4/Real_D_10.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="564.22" ytl="210.53" xbr="631.32" ybr="276.32">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="2" name="video_extract/4/Real_D_100.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="793.17" ytl="201.32" xbr="858.96" ybr="269.74">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="3" name="video_extract/4/Real_D_101.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1125.40" ytl="206.60" xbr="1162.20" ybr="229.00">
<attribute name="type">Head</attribute>
</box>
<box label="Head" occluded="0" xtl="1241.85" ytl="225.01" xbr="1310.27" ybr="301.32">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="4" name="video_extract/4/Real_D_102.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1232.64" ytl="175.01" xbr="1256.33" ybr="205.27">
<attribute name="type">Head</attribute>
</box>
<box label="Head" occluded="0" xtl="297.11" ytl="223.69" xbr="351.06" ybr="282.90">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="12" name="video_extract/4/Real_D_11.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="564.20" ytl="207.90" xbr="628.69" ybr="277.64">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="13" name="video_extract/4/Real_D_110.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="862.90" ytl="192.77" xbr="919.48" ybr="263.82">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="14" name="video_extract/4/Real_D_111.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="740.59" ytl="211.98" xbr="813.69" ybr="276.86">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="15" name="video_extract/4/Real_D_112.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1241.85" ytl="261.80" xbr="1316.85" ybr="363.17">
<attribute name="type">Head</attribute>
</box>
<box label="Head" occluded="0" xtl="772.11" ytl="238.16" xbr="851.06" ybr="318.43">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="18" name="video_extract/4/Real_D_115.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1805.01" ytl="252.64" xbr="1851.06" ybr="323.69">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="22" name="video_extract/4/Real_D_119.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="103.69" ytl="484.20" xbr="232.64" ybr="635.53">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="23" name="video_extract/4/Real_D_12.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="556.32" ytl="209.22" xbr="632.64" ybr="278.95">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="24" name="video_extract/4/Real_D_120.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="822.96" ytl="195.06" xbr="885.40" ybr="251.41">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="26" name="video_extract/4/Real_D_122.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1841.90" ytl="286.85" xbr="1895.80" ybr="353.95">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="27" name="video_extract/4/Real_D_123.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1852.80" ytl="315.80" xbr="1895.80" ybr="371.06">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="28" name="video_extract/4/Real_D_124.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1829.80" ytl="298.70" xbr="1869.49" ybr="350.80">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="33" name="video_extract/4/Real_D_129.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="588.50" ytl="290.51" xbr="679.55" ybr="388.21">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="34" name="video_extract/4/Real_D_13.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="556.74" ytl="206.10" xbr="631.30" ybr="278.56">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="35" name="video_extract/4/Real_D_130.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1142.27" ytl="208.38" xbr="1209.15" ybr="275.16">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="37" name="video_extract/4/Real_D_132.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="1028.23" ytl="346.54" xbr="1142.27" ybr="477.02">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="38" name="video_extract/4/Real_D_133.jpg" width="1920" height="1080">
<box label="Head" occluded="0" xtl="869.24" ytl="258.80" xbr="964.64" ybr="355.20">
<attribute name="type">Head</attribute>
</box>
<box label="Head" occluded="0" xtl="1091.83" ytl="202.90" xbr="1162.01" ybr="280.64">
<attribute name="type">Head</attribute>
</box>
</image>
<image id="39" name="video_extract/4/Real_D_134.jpg