def test_train(self): resnet = ResNet(dataset=DummyDataset(batch_size=2), block_nums=1, epochs=1) history = resnet.train() ok_('loss' in history)
def test_train(self): fcnn = FCNNClassifier(dataset=DummyDataset(batch_size=2), hidden_nums=16, dropout_rate=0.8) history = fcnn.train() ok_('loss' in history)
def test_load_pretrained_model(self): path = pathlib.Path(__file__).parent.joinpath('test_path') path.mkdir(parents=True, exist_ok=True) yolo = YoloV2(dataset=DummyDataset(), classification=True, epochs=1) history = yolo.train() yolo.save(path.joinpath('model')) weight = yolo.model.layers[2].weights[0] yolo = YoloV2(dataset=OjbjectDetectionDummyDataset(), restore_path=path.joinpath('model')) ok_((np.abs(weight - yolo.model.layers[2].weights[0]) <= 1e-5).all()) shutil.rmtree(path)
def test_init(self): yolo = YoloV2(dataset=OjbjectDetectionDummyDataset()) eq_(yolo.model.outputs[0].shape.as_list(), [None, 13, 13, 5 * (2 + 5)]) yolo = YoloV2(dataset=OjbjectDetectionDummyDataset(), tiny=False) eq_(yolo.model.outputs[0].shape.as_list(), [None, 13, 13, 5 * (2 + 5)]) yolo = YoloV2(dataset=DummyDataset(), classification=True) eq_(yolo.model.outputs[0].shape.as_list(), [None, DummyDataset.category_nums]) yolo = YoloV2(dataset=OjbjectDetectionDummyDataset(), tiny=False, classification=True) eq_(yolo.model.outputs[0].shape.as_list(), [None, DummyDataset.category_nums])
def test_init(self): resnet = ResNet(dataset=DummyDataset(), block_nums=1) eq_(len(resnet.blocks), 3)
def test_init_usext(self): resnet = ResNet(dataset=DummyDataset(), block_nums=1, use_xt=True) ok_(isinstance(resnet.blocks[0]['residual_path'][-4], list))
def test_init_usese(self): resnet = ResNet(dataset=DummyDataset(), block_nums=1, use_se=True) ok_(isinstance(resnet.blocks[0]['residual_path'][-1], SEBlock))
def test_init(self): efficientnet = EfficientNet(dataset=DummyDataset(), block_nums=1)
def test_train(self): efficientnet = EfficientNet(dataset=DummyDataset(), block_nums=1) history = efficientnet.train() ok_('loss' in history)
def test_train_classification(self): yolo = YoloV2(dataset=DummyDataset(), classification=True) history = yolo.train() ok_('loss' in history)
def test_init(self): fcnn = FCNNClassifier(dataset=DummyDataset(), hidden_nums=16, dropout_rate=0.8) eq_(fcnn.dense1.kernel.shape[1], 16) eq_(fcnn.dropout.rate, 0.8)