mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Check the max number of stages
This commit is contained in:
parent
d6f527e87f
commit
38d9cd951a
@ -14,8 +14,13 @@ n_stages = int(sys.argv[2])
|
|||||||
#parse xml file
|
#parse xml file
|
||||||
xmldoc = minidom.parse(sys.argv[1])
|
xmldoc = minidom.parse(sys.argv[1])
|
||||||
|
|
||||||
|
trees = xmldoc.getElementsByTagName('trees')
|
||||||
|
max_stages = len(trees)
|
||||||
|
if n_stages > max_stages:
|
||||||
|
raise Exception("The max number of stages is: %d"%(max_stages))
|
||||||
|
|
||||||
# read stages
|
# read stages
|
||||||
stages = [len(t.childNodes)/2 for t in xmldoc.getElementsByTagName('trees')][0:n_stages]
|
stages = [len(t.childNodes)/2 for t in trees][0:n_stages]
|
||||||
stage_threshold = xmldoc.getElementsByTagName('stage_threshold')[0:n_stages]
|
stage_threshold = xmldoc.getElementsByTagName('stage_threshold')[0:n_stages]
|
||||||
|
|
||||||
# total number of features
|
# total number of features
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user