Skip to content

Commit 8691f53

Browse files
committed
changes based on comments
1 parent a1b6d1e commit 8691f53

File tree

5 files changed

+56
-79
lines changed

5 files changed

+56
-79
lines changed

docker-compose.yaml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,3 @@ version: "3.9"
33
services:
44
test:
55
build: .
6-
7-
# Define the base image
8-
base-image:
9-
build:
10-
context: .
11-
dockerfile: Dockerfile
12-
image: base-image:latest # Tag it as "base-image"
13-
14-
# Define the landsat-vessels service
15-
landsat-vessels:
16-
build:
17-
context: ./rslp/landsat_vessels
18-
dockerfile: Dockerfile
19-
shm_size: '10G' # This adds the shared memory size
20-
depends_on:
21-
- base-image
22-
ports:
23-
- "5555:5555"
24-
environment:
25-
- RSLP_BUCKET
26-
- S3_ACCESS_KEY_ID
27-
- S3_SECRET_ACCESS_KEY
28-
- AWS_ACCESS_KEY_ID
29-
- AWS_SECRET_ACCESS_KEY
30-
- NVIDIA_VISIBLE_DEVICES=all # Make all GPUs visible
31-
deploy:
32-
resources:
33-
reservations:
34-
devices:
35-
- capabilities: [gpu] # Ensure this service can access GPUs
36-
runtime: nvidia # Use the NVIDIA runtime

landsat/recheck_landsat_labels/phase123_config.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ model:
2222
plateau_patience: 10
2323
plateau_min_lr: 0
2424
plateau_cooldown: 0
25-
restore_config:
26-
restore_path: gcs://rslearn-eai/datasets/landsat_vessel_detection/artifacts/2024-03-13-landsat-vessels/vessel02_satlas_freeze_crop512_nosatlas_b8first2/best.pth
27-
remap_prefixes:
28-
- ["backbone.backbone.", "encoder.0.model."]
25+
# restore_config:
26+
# restore_path: gcs://rslearn-eai/datasets/landsat_vessel_detection/artifacts/2024-03-13-landsat-vessels/vessel02_satlas_freeze_crop512_nosatlas_b8first2/best.pth
27+
# remap_prefixes:
28+
# - ["backbone.backbone.", "encoder.0.model."]
2929
data:
3030
class_path: rslearn.train.data_module.RslearnDataModule
3131
init_args:
@@ -52,6 +52,8 @@ data:
5252
allow_invalid: true
5353
skip_unknown_categories: true
5454
prob_property: "prob"
55+
positive_class: "correct"
56+
positive_class_threshold: 0.85
5557
input_mapping:
5658
class:
5759
label: "targets"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: "3.9"
2+
3+
services:
4+
# Define the base image
5+
base-image:
6+
build:
7+
context: ../..
8+
dockerfile: Dockerfile
9+
image: base-image:latest # Tag it as "base-image"
10+
11+
# Define the landsat-vessels service
12+
landsat-vessels:
13+
build:
14+
context: .
15+
dockerfile: Dockerfile
16+
shm_size: '10G' # This adds the shared memory size
17+
depends_on:
18+
- base-image
19+
ports:
20+
- "5555:5555"
21+
environment:
22+
- RSLP_BUCKET
23+
- S3_ACCESS_KEY_ID
24+
- S3_SECRET_ACCESS_KEY
25+
- AWS_ACCESS_KEY_ID
26+
- AWS_SECRET_ACCESS_KEY
27+
- NVIDIA_VISIBLE_DEVICES=all # Make all GPUs visible
28+
deploy:
29+
resources:
30+
reservations:
31+
devices:
32+
- capabilities: [gpu] # Ensure this service can access GPUs
33+
runtime: nvidia # Use the NVIDIA runtime

rslp/landsat_vessels/predict_pipeline.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def predict_pipeline(
205205
specified.
206206
"""
207207
start_time = time.time() # Start the timer
208+
time_profile = {}
208209

209210
ds_path = UPath(scratch_path)
210211
ds_path.mkdir(parents=True, exist_ok=True)
@@ -264,15 +265,23 @@ def predict_pipeline(
264265
dst_geom.time_range[1] + timedelta(minutes=30),
265266
)
266267

268+
time_profile["setup"] = time.time() - start_time
269+
267270
# Run pipeline.
268-
print("get vessel detections")
271+
step_start_time = time.time()
272+
print("run detector")
269273
detections = get_vessel_detections(
270274
ds_path, projection, scene_bounds, time_range=time_range
271275
)
276+
time_profile["get_vessel_detections"] = time.time() - step_start_time
277+
278+
step_start_time = time.time()
272279
print("run classifier")
273280
detections = run_classifier(ds_path, detections, time_range=time_range)
281+
time_profile["run_classifier"] = time.time() - step_start_time
274282

275283
# Write JSON and crops.
284+
step_start_time = time.time()
276285
crop_path = UPath(crop_path)
277286
crop_path.mkdir(parents=True, exist_ok=True)
278287

@@ -332,12 +341,18 @@ def predict_pipeline(
332341
)
333342
)
334343

344+
time_profile["write_json_and_crops"] = time.time() - step_start_time
345+
335346
elapsed_time = time.time() - start_time # Calculate elapsed time
336-
print(f"Prediction pipeline completed in {elapsed_time:.2f} seconds")
347+
time_profile["total"] = elapsed_time
337348

338349
if json_path:
339350
json_path = UPath(json_path)
340351
with json_path.open("w") as f:
341352
json.dump(json_data, f)
342353

354+
print(f"Prediction pipeline completed in {elapsed_time:.2f} seconds")
355+
for step, duration in time_profile.items():
356+
print(f"{step} took {duration:.2f} seconds")
357+
343358
return json_data

rslp/landsat_vessels/scripts/example_request.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)