File size: 2,958 Bytes
092b6a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
909eba1
092b6a4
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  "profile": "fast-v2.2-coordinate",
  "contract_version": "fast-v2.2",
  "default_for_prediction": true,
  "input": {
    "formats": [
      "JPEG",
      "PNG",
      "HEIC",
      "HEIF"
    ],
    "orientation": "Apply EXIF orientation before segmentation and crop mapping; HEIC/HEIF decoded to RGB.",
    "color": "RGB"
  },
  "segmentation": {
    "model_file": "segformer-b0-step1-448.onnx",
    "source_model": "models/fast-v2.1/segformer-b0-step1-448-fp32.onnx",
    "sha256": "96410800203e3f19b7dab26980ea6413f6f9369bb868e23bfa7f14eca6681fda",
    "input_size": [
      448,
      448
    ],
    "preparation": "Resize RGB source to 448x448 using OpenCV INTER_AREA when downsampling, otherwise INTER_LINEAR_EXACT; scale to [0,1], apply ImageNet mean/std normalization, then NCHW float32.",
    "runtime": "ONNX Runtime MIGraphX Execution Provider with migraphx_fp16_enable=1 (FP16 segmentation).",
    "output": "The model returns a water mask at 448x448."
  },
  "crop_selection": {
    "mask_projection": "Resize predicted mask to 224x224 using OpenCV INTER_NEAREST_EXACT.",
    "algorithm": "Select a rectangle from the water mask, anchored at the bottom of detected water. Candidate rectangles must retain at least 95% of water pixels in the lowest 35% of the detected-water bounding box. Prefer retention tiers >=99.5%, >=98%, then >=95%; within a tier minimize projected black padding (0.005 buckets), maximize water pixels and projected water fraction, then prefer a less extreme aspect ratio and deterministic left/top/right ordering.",
    "constraints": {
      "minimum_water_pixels": "max(32, round(224*224*0.0005))",
      "minimum_width_px": 8,
      "minimum_height_px": 8,
      "minimum_crop_area": "max(256, round(water_bbox_area*0.10))",
      "horizontal_candidate_spacing": "max(1, round(224/56)) px"
    },
    "failure": "Fail clearly if a reliable lower-water crop cannot be selected; do not fall back to an unmasked raw image."
  },
  "model_input": {
    "source_crop": "Map the selected 224x224 rectangle to oriented source-image coordinates using floor for left/top and ceil for right/bottom; crop original RGB pixels.",
    "resize": "Preserve aspect ratio; resize with OpenCV INTER_LANCZOS4 and center on a black 224x224 RGB canvas.",
    "mask": "Resize selected water mask with OpenCV INTER_NEAREST_EXACT and black out non-water pixels.",
    "jpeg_roundtrip": {
      "quality": 95,
      "subsampling": "4:4:4"
    },
    "tensor": "Decode the final JPEG to RGB; convert to float32 [0,1], normalize by ImageNet mean [0.485,0.456,0.406] and std [0.229,0.224,0.225], then convert to NCHW.",
    "size": [
      224,
      224
    ]
  },
  "source_implementation": "https://github.com/kubilaycaglayan/wave-regression-model/blob/main/scripts_pipeline/step_7_i_migraphx_server.py",
  "source_model_manifest": "https://github.com/kubilaycaglayan/wave-regression-model/blob/main/models/fast-v2.2/model-manifest.json"
}