-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |