(client, name2idx)
| 1 | |
| 2 | def ChangeLabeling(client, name2idx): |
| 3 | idx2name = {v['index']:k for k,v in name2idx.items()} |
| 4 | change_types = {'_static':0*50,'_new':1*50,'_missing':2*50,'_rotated':3*50,'_replaced':4*50} |
| 5 | count = {'_static':0,'_new':0,'_missing':0,'_rotated':0,'_replaced':0} |
| 6 | obj_list = client.simListSceneObjects() |
| 7 | for obj_name in obj_list: |
| 8 | for change_label,change_idx in change_types.items(): |
| 9 | if change_label in obj_name: |
| 10 | obj_ID_before = client.simGetSegmentationObjectID(obj_name.lower()) |
| 11 | found = client.simSetSegmentationObjectID(obj_name,obj_ID_before+change_idx) |
| 12 | status = 'SUCCESS' if found else 'FAILED' |
| 13 | |
| 14 | |
| 15 | |
| 16 | try: |
| 17 | semantic_label = idx2name[obj_ID_before] |
| 18 | except: |
| 19 | import pdb;pdb.set_trace() |
| 20 | obj_ID_after = client.simGetSegmentationObjectID(obj_name.lower()) |
| 21 | print('[{}][{}][{}] {}: remapped from {} to {}'.format(status,change_label[1:], |
| 22 | semantic_label, obj_name, |
| 23 | obj_ID_before,obj_ID_after)) |
| 24 | count[change_label]+=1 |
| 25 | print('Change Labeling Done.') |
| 26 | print('Change stats: \n{}'.format(count)) |
no outgoing calls
no test coverage detected