I have a list with the following sample key value pairs:
results : {'ROI_0':[{'obj_id':1,'obj_name':'truck', 'obj_confi':93.55, 'bb_box': ['x','y','w','h']},
{'obj_id':2,'obj_name':'truck', 'obj_confi':91.35, 'bb_box': ['x','y','w','h']},
{'obj_id':3,'obj_name':'truck', 'obj_confi':92.65, 'bb_box': ['x','y','w','h']},
{'obj_id':4,'obj_name':'car', 'obj_confi':90.31, 'bb_box': ['x','y','w','h']},
{'obj_id':5,'obj_name':'car', 'obj_confi':90.31, 'bb_box': ['x','y','w','h']}
]}
I need to obtain another list which looks like the one below:
aggreg_results : {'ROI_0':[{'obj_occurances': 3, 'obj_name': 'truck', 'obj_ids':[1,2,3]},
{'obj_occurances': 2, 'obj_name': 'car', 'obj_ids':[4,5]}
]}
Unable to figure out the logic to this.