Skip to content

Commit

Permalink
cropmodel still fails
Browse files Browse the repository at this point in the history
  • Loading branch information
bw4sz committed Nov 19, 2024
1 parent 996e282 commit 1cfdf6a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 233 deletions.
24 changes: 24 additions & 0 deletions tests/test_active_learning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest
from src.active_learning import choose_train_images, choose_test_images

@pytest.fixture
def performance():
return {"detection": 0.9, "classification": 0.8}

@pytest.fixture
def detection_model():
from deepforest import main
return main.deepforest()

@pytest.fixture
def classification_model():
from deepforest.model import CropModel
return CropModel()

def test_choose_train_images(performance, detection_model, config):
train_images_to_annotate = choose_train_images(performance, detection_model, **config.active_learning)
assert len(train_images_to_annotate) > 0

def test_choose_test_images(performance, detection_model, config):
test_images_to_annotate = choose_test_images(performance, **config.active_testing)
assert len(test_images_to_annotate) > 0
233 changes: 0 additions & 233 deletions tests/test_data_processing.py

This file was deleted.

16 changes: 16 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest
import pandas as pd
from deepforest import main
from deepforest.model import CropModel
from src.model import preprocess_and_train

@pytest.mark.parametrize("model_type", ["detection", "classification"])
def test_preprocess_and_train(config, model_type, crop_model):
if model_type == "detection":
model = main.deepforest()
else:
model = CropModel()
model.create_trainer(fast_dev_run=True)

validation_df = pd.read_csv(config.detection_model.validation_csv_path)
trained_model = preprocess_and_train(config, m=model, validation_df=validation_df, model_type=model_type)

0 comments on commit 1cfdf6a

Please sign in to comment.