hdict文件操作

发布时间 2023-10-26 13:51:16作者: QuincyYi

create_dict (DLDataset)
set_dict_tuple (DLDataset, 'class_ids', [0,1,2,3])
set_dict_tuple (DLDataset, 'class_names', ['ng_anlie','ng_innerwuran','ng_innerwuranmh','ng_outterwuran'])
set_dict_tuple (DLDataset, 'image_dir', 'E:/ImageDetection/Images/')

create_dict (LabelInfoDataset)
set_dict_tuple (LabelInfoDataset, 'image_id', 1)
set_dict_tuple (LabelInfoDataset, 'image_file_name', '200.bmp')
set_dict_tuple (LabelInfoDataset, 'bbox_label_id', 0)
set_dict_tuple (LabelInfoDataset, 'bbox_row1', 276.046)
set_dict_tuple (LabelInfoDataset, 'bbox_col1', 154.89)
set_dict_tuple (LabelInfoDataset, 'bbox_row2', 309.556)
set_dict_tuple (LabelInfoDataset, 'bbox_col2', 214.15)

for Index := 0 to 544 by 1
set_dict_tuple_at (DLDataset, 'samples', Index,LabelInfoDataset)
endfor

write_dict (DLDataset, 'E:/yqs/HalconExample/dataset', ['file_type'], ['hdict'])


read_dict ('E:/HalconExample/dataset.hdict', [], [], DictHandle)