def test_2_train_faces(self): base_model_path = base_models_dir + '/inception_v1' trainer = Trainer(base_model_path, test_dir + '/fixtures/scaffolds/faces', num_steps=10000) trainer.prepare() benchmark_info = trainer.train(test_dir + '/fixtures/tmp/faces_test') validate_model(test_dir + '/fixtures/tmp/faces_test') self.assertEqual(benchmark_info['test_accuracy'] >= 0.80, True)
def test_7_train_coffee_roasts(self): scaffold_dir = test_dir + '/fixtures/scaffolds/coffee_roasts' output_model_path = test_dir + '/fixtures/tmp/coffee_roasts_test' base_model_path = base_models_dir + '/inception_v3' trainer = Trainer(base_model_path, scaffold_dir, num_steps=100) clear_scaffold_cache(scaffold_dir) trainer.prepare() benchmark_info = trainer.train(output_model_path) self.assertEqual(benchmark_info['test_accuracy'] >= 0.75, True) validate_model(output_model_path)
def test_5_train_scene_type_resnet_v2(self): scaffold_dir = test_dir + '/fixtures/scaffolds/scene_type' output_model_path = test_dir + '/fixtures/tmp/scene_type_test_resnetv2' base_model_path = base_models_dir + '/inception_resnet_v2' trainer = SlimTrainer(base_model_path, scaffold_dir, num_steps=20, batch_size=32) clear_scaffold_cache(scaffold_dir) trainer.prepare() benchmark_info = trainer.train(output_model_path) self.assertEqual(benchmark_info['final_loss'] <= 0.80, True) validate_model(output_model_path)