Image_Height, Image_Width = float(xml_file['annotation']['size']['height']), float(xml_file['annotation']['size']['width'])
label = np.zeros((7, 7, 25), dtype=float) # ⑤
objects = xml_file['annotation']['object']
if not isinstance(objects, list): objects = [objects]
for obj in objects:
class_index = Classes_inDataSet.index(obj['name'].lower()) # ⑥
coordinates = float(obj['bndbox']['xmin']), float(obj['bndbox']['ymin']), float(obj['bndbox']['xmax']), float(obj['bndbox']['ymax'])
x, y, w, h = transform_coordinates(coordinates, Image_Width, Image_Height) # ⑦
x_cell, y_cell = int(x / 32), int(y / 32)
x_val_inCell, y_val_inCell = (x - x_cell * 32.0) / 32.0, (y - y_cell * 32.0) / 32.0
class_index_inCell = class_index + 5
label[y_cell, x_cell, :5] = [x_val_inCell, y_val_inCell, w, h, 1.0]
label[y_cell, x_cell, class_index_inCell] = 1.0
return label