Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bhavesh907/Crop-Classification
/ functions
Functions
32 in github.com/bhavesh907/Crop-Classification
⨍
Functions
32
◇
Types & classes
2
↓ 7 callers
Function
_make_df
(n: int = 200)
tests/test_features.py:9
↓ 7 callers
Function
compute_ndvi
Add per-timestamp NDVI columns (``t{t}_ndvi``) to *df*. NDVI = (NIR - Red) / (NIR + Red). A small epsilon avoids division by zero.
src/features.py:8
↓ 4 callers
Function
_make_mock_image
(n_rows: int, n_cols: int, seed: int = 0)
tests/test_preprocess.py:16
↓ 4 callers
Function
_make_mock_roi
(n_rows: int, n_cols: int)
tests/test_preprocess.py:21
↓ 4 callers
Function
get_feature_array
Return ``(X, y)`` where X has shape ``(n, n_timestamps * features_per_step)``. Feature order within each timestep: [b0, b1, …, b{N_BANDS-1},
src/features.py:22
↓ 1 callers
Function
_load_image
(path: Path)
src/preprocess.py:36
↓ 1 callers
Function
_load_roi
(path: Path)
src/preprocess.py:29
↓ 1 callers
Function
_plot_confusion_matrix
(cm: np.ndarray, labels: list[str], model_type: str)
src/evaluate.py:43
↓ 1 callers
Function
build_cnn
1-D CNN over the temporal axis with global average pooling.
src/models.py:29
↓ 1 callers
Function
build_dataset
Return a DataFrame with shape (n_classes * n_samples, n_timestamps*n_bands + 1). Columns are named ``t{t}_b{b}`` for timestamp t, band b, pl
src/preprocess.py:47
↓ 1 callers
Function
build_lstm
Bidirectional LSTM — the recommended architecture for temporal spectral data. Processing the sequence in both directions captures phenologic
src/models.py:53
↓ 1 callers
Function
build_mlp
Fully-connected baseline operating on the flat feature vector.
src/models.py:7
↓ 1 callers
Function
evaluate
Print and save: - Per-class precision / recall / F1 report - Confusion matrix PNG - Training curve PNG (if *history* passed separatel
src/evaluate.py:15
↓ 1 callers
Function
load_dataset
(path: Path = PROCESSED_CSV)
src/preprocess.py:107
↓ 1 callers
Function
main
()
scripts/train.py:29
↓ 1 callers
Function
main
()
scripts/preprocess.py:26
↓ 1 callers
Function
plot_training_curve
Save loss and accuracy curves from a Keras History object.
src/evaluate.py:65
↓ 1 callers
Function
save_dataset
(df: pd.DataFrame, path: Path = PROCESSED_CSV)
src/preprocess.py:101
↓ 1 callers
Function
train
Train a crop-classification model and return evaluation artefacts. Parameters ---------- df : pd.DataFrame Output of ``prepr
src/train.py:20
Method
mock_load_image
(path)
tests/test_preprocess.py:50
Method
mock_load_image
(path)
tests/test_preprocess.py:119
Function
test_compute_ndvi_adds_columns
()
tests/test_features.py:20
Method
test_dataset_column_count
Dataset must have N_TIMESTAMPS * N_BANDS band columns + 1 class column.
tests/test_preprocess.py:63
Function
test_feature_array_temporal_reshape
Flat array must reshape cleanly to (n, T, F) without reordering data.
tests/test_features.py:65
Function
test_get_feature_array_shape
()
tests/test_features.py:51
Function
test_get_feature_array_without_ndvi
()
tests/test_features.py:59
Function
test_ndvi_does_not_mutate_input
()
tests/test_features.py:44
Function
test_ndvi_formula
Spot-check NDVI = (NIR - Red) / (NIR + Red) for a known pixel.
tests/test_features.py:34
Function
test_ndvi_range
()
tests/test_features.py:27
Method
test_no_duplicate_pixel_indices_within_class
Each class block should have unique pixel locations (no replacement).
tests/test_preprocess.py:83
Method
test_same_indices_used_per_timestamp
Call build_dataset with mocked GDAL and assert that _load_image is called with the *same* row/col index arrays for every timestamp.
tests/test_preprocess.py:35
Method
test_samples_capped_by_available_pixels
When n_samples > available pixels, all available pixels are used.
tests/test_preprocess.py:111