def test_finds_bounding_boxes(self): trainer = TrainImageGenerator( annotation_path="../../datasets/micro/annotations.csv", images_path="../../datasets/micro") x, y = trainer.generate_sample(0) found_boxes = interpret_label(y, FEATURE_MAPS) self.assertTrue(len(found_boxes) > 0)
def test_single_sample_generation(self): trainer = TrainImageGenerator( annotation_path="../../datasets/mini/annotations.csv", images_path="../../datasets/mini") x, y = trainer.generate_sample(0) self.assertEqual(np.shape(x), (300, 300, 3)) self.assertEqual(len(y), len(FEATURE_MAPS)) for layer, fm in zip(y, FEATURE_MAPS): self.assertEqual(fm.width, layer.shape[0]) self.assertEqual(fm.height, layer.shape[1]) self.assertEqual(len(fm.aspect_ratios), layer.shape[2]) self.assertEqual(layer.shape[3], 5)
from postprocessing.visualization import visualize_prediction from dataset_generation.data_feeder import TrainImageGenerator from dataset_generation.augmenter import NoAgumenter if __name__ == "__main__": generator = TrainImageGenerator("../../datasets/micro/annotations.csv", "../../datasets/micro", batch_size=1, augumenter=NoAgumenter()) img, label = generator.generate_sample(0) visualize_prediction(img, label)