(self, input, input_batch_id, file_name)
| 73 | return input |
| 74 | |
| 75 | def extract_instance_list_from_batch(self, input, input_batch_id, file_name): |
| 76 | if input_batch_id is None: |
| 77 | return |
| 78 | input_batch = InputBatch.get_by_id(self.session, id = input_batch_id) |
| 79 | if not input_batch: |
| 80 | return |
| 81 | pre_labels = input_batch.pre_labeled_data |
| 82 | if pre_labels is None: |
| 83 | return input |
| 84 | uuid = None |
| 85 | file_data = None |
| 86 | if self.request: |
| 87 | uuid = self.request.form.get('uuid') |
| 88 | file_data = pre_labels.get(uuid) |
| 89 | if file_data is None: |
| 90 | # Try finding the pre_labels with the file_name as a backup |
| 91 | file_data = pre_labels.get(file_name) |
| 92 | if file_data is None: |
| 93 | logger.warning(f"Input: {input.id} File {file_name} has no pre_labeled data associated") |
| 94 | return |
| 95 | project_labels = self.get_project_labels() |
| 96 | |
| 97 | if file_data['instance_list']: |
| 98 | instance_list = file_data['instance_list'] |
| 99 | for instance in instance_list: |
| 100 | label_file = list(filter(lambda x: x['label']['name'] == instance['name'], project_labels))[0] |
| 101 | instance['label_file_id'] = label_file['id'] |
| 102 | input.instance_list = {'list': file_data['instance_list']} |
| 103 | |
| 104 | if file_data['frame_packet_map']: |
| 105 | frame_packet_map = file_data['frame_packet_map'] |
| 106 | for frame, instance_list in frame_packet_map.items(): |
| 107 | for instance in instance_list: |
| 108 | label_file = list(filter(lambda x: x['label']['name'] == instance['name'], project_labels))[0] |
| 109 | instance['label_file_id'] = label_file['id'] |
| 110 | input.frame_packet_map = frame_packet_map |
| 111 | return input |
| 112 | |
| 113 | def route_from_unique_id(self): |
| 114 | """ |
no test coverage detected