# Configuration

## Minimal TIF Workflow

```yaml
vipr:
  inference:
    load_data:
      handler: gid_tif_reader
      parameters:
        data_path: '@vipr_gid/mlgiddetect/examples/data/w4_mapbbr32.tif'
        frame_index: 0

    load_model:
      handler: mlgiddetect
      parameters:
        model_name: frcnn
        device: cpu
        input_size: '800,800'

    prediction:
      handler: mlgiddetect_predictor
      parameters:
        score_threshold: 0.8

    postprocess:
      handler: mlgiddetect_postprocessor
      parameters:
        postprocess_boxes: true
```

## Minimal HDF5 Workflow

```yaml
vipr:
  inference:
    load_data:
      handler: gid_pygid_h5_reader
      parameters:
        data_path: /path/to/data.h5
        frame_index: 0
        # optional:
        # h5_img_path: entry/analysis/q_image
        # h5_qxy_path: entry/analysis/q_xy
        # h5_qz_path:  entry/analysis/q_z
```

## Optional Preprocess Filter

```yaml
vipr:
  inference:
    filters:
      INFERENCE_PREPROCESS_PRE_FILTER:
      - class: vipr_gid.mlgiddetect.preprocess.polar_transform_filter.PolarTransformFilter
        enabled: true
        method: preprocess_polar
        parameters: {}
        weight: 0
```

## Key Parameters

### `load_data`
- `gid_tif_reader`:
  - `data_path` (required)
  - `frame_index` (default `0`)
- `gid_pygid_h5_reader`:
  - `data_path` (required)
  - `frame_index` (default `0`)
  - `h5_img_path`, `h5_qxy_path`, `h5_qz_path` (optional)

### `load_model` (`mlgiddetect`)
- `model_path` (optional; if missing, model is downloaded/cached)
- `model_name` (`frcnn`, `rfdetrbase`, `rfdetrlarge`)
- `device` (`cpu` or `cuda`)
- `input_size` (e.g. `'800,800'`)

### `prediction` (`mlgiddetect_predictor`)
- `score_threshold` (default `0.5`)

### `postprocess` (`mlgiddetect_postprocessor`)
- `postprocess_boxes`
- `min_q_pix`
- `merge_min_score`, `merge_min_iou`, `merge_max_q`, `merge_quantile`
- `nms_level`, `final_score_level`
