Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyroengine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ class Engine:
def __init__(
self,
model_path: Optional[str] = None,
conf_thresh: float = 0.2,
conf_thresh: float = 0.35,
model_conf_thresh: float = 0.05,
max_bbox_size: float = 0.4,
api_url: Optional[str] = None,
cam_creds: Optional[Dict[str, Dict[str, str]]] = None,
nb_consecutive_frames: int = 5,
nb_consecutive_frames: int = 7,
frame_size: Optional[Tuple[int, int]] = None,
cache_backup_period: int = 60,
frame_saving_period: Optional[int] = None,
Expand Down
4 changes: 2 additions & 2 deletions src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def main(args):
)
# Model
parser.add_argument("--model_path", type=str, default=None, help="model path")
parser.add_argument("--thresh", type=float, default=0.2, help="Confidence threshold")
parser.add_argument("--thresh", type=float, default=0.35, help="Confidence threshold")
parser.add_argument("--max_bbox_size", type=float, default=0.4, help="Maximum bbox size")

# Camera & cache
Expand All @@ -106,7 +106,7 @@ def main(args):
parser.add_argument(
"--nb-consecutive_frames",
type=int,
default=5,
default=6,
help="Number of consecutive frames to combine for prediction",
)
parser.add_argument(
Expand Down
15 changes: 13 additions & 2 deletions tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,25 @@
assert isinstance(out, float)
assert 0 <= out <= 1
assert len(engine._states["-1"]["last_predictions"]) == 3
assert engine._states["-1"]["ongoing"]
assert not engine._states["-1"]["ongoing"]

Check warning on line 59 in tests/test_engine.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_engine.py#L59

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert isinstance(engine._states["-1"]["last_predictions"][0][0], Image.Image)
assert engine._states["-1"]["last_predictions"][2][1].shape[0] > 0
assert engine._states["-1"]["last_predictions"][2][1].shape[1] == 5
assert len(engine._states["-1"]["last_predictions"][-1][2][0]) == 5
assert engine._states["-1"]["last_predictions"][2][3] < datetime.now().isoformat()
assert engine._states["-1"]["last_predictions"][2][4] is False

out = engine.predict(mock_wildfire_image)
assert isinstance(out, float)
assert 0 <= out <= 1
assert len(engine._states["-1"]["last_predictions"]) == 4

Check warning on line 69 in tests/test_engine.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_engine.py#L69

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert engine._states["-1"]["ongoing"]
assert isinstance(engine._states["-1"]["last_predictions"][0][0], Image.Image)
assert engine._states["-1"]["last_predictions"][3][1].shape[0] > 0

Check warning on line 72 in tests/test_engine.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_engine.py#L72

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert engine._states["-1"]["last_predictions"][3][1].shape[1] == 5

Check warning on line 73 in tests/test_engine.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_engine.py#L73

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert len(engine._states["-1"]["last_predictions"][-1][2][0]) == 5
assert engine._states["-1"]["last_predictions"][3][3] < datetime.now().isoformat()

Check warning on line 75 in tests/test_engine.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_engine.py#L75

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert engine._states["-1"]["last_predictions"][3][4] is False

Check warning on line 76 in tests/test_engine.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/test_engine.py#L76

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.


def create_dummy_onnx_model(model_path):
"""Creates a small dummy ONNX model."""
Expand Down
Loading