def readBehavior(self):
    assert self.filepath.endswith(XML_EXT), 'Unsupport file format'
    parser = etree.XMLParser(encoding=ENCODE_METHOD)
    xmltree = ElementTree.parse(self.filepath, parser=parser).getroot()
    for object_iter in xmltree.findall('behaviors'):
        label = object_iter.find('behavior').text
        object_id = int(object_iter.find('behavior_id').text)
        start_frame = object_iter.find('start_frame').text
        end_frame = object_iter.find('end_frame').text
        shapes = object_iter.find('bounding_boxes')
        bounding_boxes = []
        for shape_tier in shapes.findall('bounding_box'):
            box = {}
            bndbox = shape_tier.find('bndbox')
            box['bndbox'] = bndbox
            frame = shape_tier.find('frame')
            box['frame'] = frame.text
            bounding_boxes.append(box)
        self.addBehavior(label, object_id, start_frame, end_frame, bounding_boxes)
    return True
def readBehavior(self):
    assert self.filepath.endswith(XML_EXT), 'Unsupport file format'
    parser = etree.XMLParser(encoding=ENCODE_METHOD)
    xmltree = ElementTree.parse(self.filepath, parser=parser).getroot()
    for object_iter in xmltree.findall('behaviors'):
        label = object_iter.find('behavior').text
        object_id = int(object_iter.find('behavior_id').text)
        start_frame = object_iter.find('start_frame').text
        end_frame = object_iter.find('end_frame').text
        shapes = object_iter.find('bounding_boxes')
        bounding_boxes = []
        for shape_tier in shapes.findall('bounding_box'):
            box = {}
            bndbox = shape_tier.find('bndbox')
            box['bndbox'] = bndbox
            frame = shape_tier.find('frame')
            box['frame'] = frame.text
            bounding_boxes.append(box)
        self.addBehavior(label, object_id, start_frame, end_frame, bounding_boxes)
    return True