def make_labeled_frames_from_generator(self, generator, data_provider): grouped_generator = group_examples_iter(generator) skeleton = self.bottomup_config.data.labels.skeletons[0] def make_lfs(video_ind, frame_ind, frame_examples): return make_grouped_labeled_frame( video_ind=video_ind, frame_ind=frame_ind, frame_examples=frame_examples, videos=data_provider.videos, skeleton=skeleton, image_key="image", points_key="predicted_instances", point_confidences_key="predicted_peak_scores", instance_score_key="predicted_instance_scores", tracker=self.tracker, ) predicted_frames = [] for (video_ind, frame_ind), grouped_examples in grouped_generator: predicted_frames.extend(make_lfs(video_ind, frame_ind, grouped_examples)) if self.tracker: self.tracker.final_pass(predicted_frames) return predicted_frames
def test_group_iterator(): examples = make_examples() # Use iterator to build grouped dict grouped = dict() for key, val in group_examples_iter(examples): grouped[key] = val check_grouped_examples(grouped)
def make_labeled_frames_from_generator(self, generator, data_provider): grouped_generator = group_examples_iter(generator) skeleton = self.confmap_config.data.labels.skeletons[0] def make_lfs(video_ind, frame_ind, frame_examples): return make_grouped_labeled_frame( video_ind=video_ind, frame_ind=frame_ind, frame_examples=frame_examples, videos=data_provider.videos, skeleton=skeleton, points_key="predicted_instance", point_confidences_key="predicted_instance_confidences", ) predicted_frames = [] for (video_ind, frame_ind), grouped_examples in grouped_generator: predicted_frames.extend(make_lfs(video_ind, frame_ind, grouped_examples)) return predicted_frames