Skip to content

Commit 2ed85b7

Browse files
committed
make the dockerfile reference the fork of flat-bug
1 parent 8b8df2b commit 2ed85b7

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

processing_services/example/FLAT_BUG_IMPLEMENTATION.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,35 @@ I've successfully implemented the `FlatBugObjectDetector` class to use the actua
77
## Key Changes Made
88

99
### 1. Updated `compile()` method
10+
1011
- **Before**: Used `transformers.pipeline` with a placeholder checkpoint
11-
- **After**: Uses `flat_bug.predictor.Predictor` with the default model `'flat_bug_M.pt'`
12+
- **After**: Uses `flat_bug.predictor.Predictor` with the default model `'flat_bug_N.pt'`
1213
- The model will be automatically downloaded on first use
1314
- Added configurable hyperparameters (score threshold, IoU threshold, etc.)
1415

1516
### 2. Updated `run()` method
17+
1618
- **Before**: Called `self.model(image, candidate_labels=...)`
1719
- **After**: Uses `self.model.pyramid_predictions(image)` which is the flat-bug API
1820
- Handles the `TensorPredictions` response format from flat-bug
1921
- Converts tensors to numpy arrays and extracts bounding boxes and scores
2022

2123
### 3. Updated description
24+
2225
- Now accurately reflects that it uses the actual flat-bug library
2326
- Mentions specialization for terrestrial arthropod detection
2427

2528
## How It Works
2629

2730
1. **Installation**: Flat-bug needs to be installed from source:
31+
2832
```bash
2933
git clone https://github.com/darsa-group/flat-bug.git
3034
cd flat-bug
3135
pip install -e .
3236
```
3337

34-
2. **Model Loading**: The `flat_bug_M.pt` model is downloaded automatically on first use
38+
2. **Model Loading**: The `flat_bug_N.pt` model is downloaded automatically on first use
3539

3640
3. **Inference**: Uses flat-bug's pyramid tiling approach for detection on arbitrarily large images
3741

@@ -50,6 +54,7 @@ pip install torch>=2.3
5054
## Testing
5155

5256
I've created `test_flat_bug_implementation.py` which you can run to:
57+
5358
- Verify the flat-bug installation
5459
- Inspect the actual format of `TensorPredictions` objects
5560
- Confirm the attribute names and data structures

processing_services/example/api/algorithms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def compile(self, device: str | None = None):
199199
logger.info(f"Compiling {self.algorithm_config_response.name} on device {device_choice}...")
200200

201201
# Initialize flat-bug predictor with default model
202-
self.model = Predictor(model="flat_bug_M.pt", device=device_choice) # Default flat-bug model
202+
self.model = Predictor(model="flat_bug_N.pt", device=device_choice) # Default flat-bug model
203203

204204
# Set some reasonable hyperparameters
205205
# TIME=False is critical to avoid CUDA event errors when running on CPU

processing_services/example/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ torchvision==0.21.0
99
scipy==1.16.0
1010
# Use headless OpenCV to avoid GUI dependencies in Docker
1111
opencv-python-headless==4.13.0.92
12-
flat_bug @ https://github.com/darsa-group/flat-bug/archive/refs/heads/main.zip
12+
flat_bug @ https://github.com/atticus29/flat-bug/archive/refs/heads/main.zip
1313

processing_services/example/test_flat_bug_implementation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_flat_bug_api():
3636

3737
# Initialize predictor
3838
device = "cuda" if torch.cuda.is_available() else "cpu"
39-
predictor = Predictor(model="flat_bug_M.pt", device=device)
39+
predictor = Predictor(model="flat_bug_N.pt", device=device)
4040
print(f"✓ Initialized Predictor with device: {device}")
4141

4242
# Set hyperparameters - DISABLE timing to avoid CUDA event error on CPU
@@ -106,7 +106,7 @@ def show_installation_instructions():
106106
print("3. Make sure PyTorch is installed:")
107107
print(" pip install torch>=2.3")
108108
print()
109-
print("4. The model 'flat_bug_M.pt' will be downloaded automatically")
109+
print("4. The model 'flat_bug_N.pt' will be downloaded automatically")
110110
print(" on first use.")
111111
print()
112112

0 commit comments

Comments
 (0)