Root cause of Am-241 misidentification: the Radiacode 103's CsI(Tl) crystal shifts low-energy peaks upward (59.5 keV → 71.6 keV for Am-241) due to non-proportional scintillation response. The model was trained on theoretical peak positions and couldn't match the shifted real peaks. Changes: - Add inverse CsI(Tl) non-linear correction to inference pipeline (radiacode_monitor.py, web/config.py, test_detection.py) E_apparent = E_true * (1 + 0.37 * exp(-E_true/100)) Corrects channel mapping so peaks appear at theoretical energies - Fix energy calibration: DetectorConfig now uses E = 0.33 + 2.97*ch with 1023 channels, matching the real detector (was energy_min=20, skip_first_channel=True, different channel width) - Add K-escape peaks for CsI(Tl) iodine X-ray escape (E - 28.5 keV) - Add asymmetric peak shapes for low-energy tails (< 200 keV) - Add log1p normalization in dataset and inference (replaces max-norm) - Add background-subtracted training mode (subtract_background flag) - Add low-signal augmentation (0.01-5 Bq activities, 30-300s durations) - Update docker-compose.yml: batch_size=32, duration=30-300s, CSI_NONLINEAR_ALPHA/BETA env vars for detect and web - Web dashboard: apply CsI correction to displayed spectra - Various UI fixes (Chart.js width, zoom/pan, isotope lines) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
82 lines
2.1 KiB
YAML
82 lines
2.1 KiB
YAML
services:
|
|
train:
|
|
build:
|
|
context: ./train
|
|
dockerfile: Dockerfile
|
|
volumes:
|
|
- ./data:/data
|
|
- ./models:/models
|
|
deploy:
|
|
resources:
|
|
reservations:
|
|
devices:
|
|
- driver: nvidia
|
|
count: all
|
|
capabilities: [gpu]
|
|
environment:
|
|
- NVIDIA_VISIBLE_DEVICES=1
|
|
- CUDA_VISIBLE_DEVICES=1
|
|
- DATA_DIR=/data/synthetic
|
|
- MODEL_DIR=/models
|
|
- NUM_SAMPLES=50000
|
|
- EPOCHS=100
|
|
- BATCH_SIZE=32
|
|
- LEARNING_RATE=0.001
|
|
- DETECTOR=radiacode_103
|
|
- MIN_DURATION=30
|
|
- MAX_DURATION=300
|
|
- SEED=42
|
|
- MEASURED_BACKGROUND_PATH=/data/background_24h.npy
|
|
restart: "no"
|
|
|
|
detect:
|
|
build:
|
|
context: ./detect
|
|
dockerfile: Dockerfile
|
|
volumes:
|
|
- ./models:/models:ro
|
|
- ./logs:/logs
|
|
- ./data:/data
|
|
devices:
|
|
- /dev/bus/usb:/dev/bus/usb
|
|
privileged: true
|
|
environment:
|
|
- MODEL_PATH=/models/vega_best.pt
|
|
- ISOTOPE_INDEX_PATH=/models/vega_isotope_index.txt
|
|
- BACKGROUND_PATH=/data/background_24h.npy
|
|
- STATE_PATH=/data/monitor_state.json
|
|
- CPS_LOG_PATH=/data/cps_log.jsonl
|
|
- VEGA_ML_PATH=/models/vega_ml
|
|
- VEGA_DEVICE=cpu
|
|
- LOG_DIR=/logs
|
|
- SAMPLE_INTERVAL=60
|
|
- REPORT_HOUR=0
|
|
- MIN_LIVE_TIME=3600
|
|
- THRESHOLD=0.5
|
|
- CSI_NONLINEAR_ALPHA=0.37
|
|
- CSI_NONLINEAR_BETA=100.0
|
|
restart: unless-stopped
|
|
|
|
web:
|
|
build:
|
|
context: ./web
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8000:8080"
|
|
volumes:
|
|
- ./data:/data:ro
|
|
- ./logs:/logs:ro
|
|
- ./models/vega_isotope_index.txt:/models/vega_isotope_index.txt:ro
|
|
environment:
|
|
- STATE_PATH=/data/monitor_state.json
|
|
- CPS_LOG_PATH=/data/cps_log.jsonl
|
|
- BACKGROUND_PATH=/data/background_24h.npy
|
|
- BACKGROUND_SNAPSHOT_PATH=/data/background_snapshot.json
|
|
- LOG_DIR=/logs
|
|
- ISOTOPE_INDEX_PATH=/models/vega_isotope_index.txt
|
|
- ENERGY_CALIBRATION_OFFSET=0.33
|
|
- ENERGY_CALIBRATION_SLOPE=2.97
|
|
- CSI_NONLINEAR_ALPHA=0.37
|
|
- CSI_NONLINEAR_BETA=100.0
|
|
restart: unless-stopped
|