{
  "_note": "TEMPLATE. Edit the classes, rulebook and policies to your project, then get the class map signed off before labeling starts. Guide: https://trainmatricx.com/blog/basketball-court-segmentation-mask-labeling-paint-lines",
  "class_map_version": "example-1.0",
  "rulebook": {
    "name": "FIBA Official Basketball Rules 2026",
    "alternatives": [
      "NBA Official Rule No. 1",
      "NCAA court diagram for the season"
    ],
    "why_it_matters": "Rulebooks differ on lane width, arc distance and which region a line belongs to."
  },
  "mask_format": {
    "file_type": "PNG, 8-bit, single channel, lossless",
    "pixel_value": "class index from 'classes' below",
    "resolution": "same width and height as the source frame; never resized",
    "antialiasing": "none: every pixel holds exactly one class index",
    "one_file_per": "frame, named <video_id>_<frame_index>.png",
    "alternative_format": "COCO RLE inside a JSON annotation file, one RLE per class per frame"
  },
  "classes": [
    {
      "index": 0,
      "name": "off_court",
      "definition": "Everything outside the boundary lines: apron, benches and the people on them, crowd, advertising boards."
    },
    {
      "index": 1,
      "name": "court_floor",
      "definition": "In-bounds playing surface that is not paint and not a line."
    },
    {
      "index": 2,
      "name": "paint",
      "definition": "Inside of the lane, excluding its painted lines. FIBA calls this the restricted area; the NBA's 'restricted area' is the 4 ft arc under the basket."
    },
    {
      "index": 3,
      "name": "line",
      "definition": "Any painted court marking: boundary, lane, free-throw, three-point, centre and circle lines."
    },
    {
      "index": 255,
      "name": "ignore",
      "definition": "Pixels not to be scored or trained on: players, referees, ball, and floor whose class cannot be decided from the frame."
    }
  ],
  "policies": {
    "line_ownership": "Lines are their own class (3). Which region a line belongs to under the rulebook is recorded here, not painted into the mask, so it can be derived later.",
    "line_ownership_by_rule": {
      "FIBA_2026": {
        "boundary_lines": "not part of the court",
        "restricted_area_lines_except_endline": "part of the restricted area",
        "three_point_line": "not part of the 3-point goal area"
      },
      "NBA_rule_1": {
        "lane_boundary_lines": "part of the lane"
      },
      "NCAA": {
        "note": "Check the court diagram for the season; record the rule here before labeling."
      }
    },
    "occluders": "By default, players, referees and the ball are 255. Do not guess the floor class underneath them.",
    "partly_hidden_lines": "Label only the visible part of a line. Do not extend it under a player.",
    "uncertain_pixels": "If a pixel cannot be assigned from the frame (motion blur, glare, logo over a line), use 255 and add a note in the frame log.",
    "floor_logos_and_decals": "Label by the region they sit in (paint or court_floor), not as a separate class, unless the project adds one.",
    "camera_cuts": "Close-ups, replays and graphics frames with no visible court: skip, or mark the whole frame 255 and log it.",
    "overlapping_markings": "Courts with lines for several sports or rule eras: label only the set named in 'rulebook' as line; treat all other markings as the region they sit in."
  },
  "quality_check": {
    "regions": "Per-class IoU against a reviewed reference on a held-out sample of frames.",
    "lines": "Two-sided tolerance measure: share of labeled line pixels within N pixels of the reference (precision) and share of reference line pixels within N pixels of the label (recall), or their F score. IoU on thin lines swings with 1-pixel shifts.",
    "file_checks": "Every file: correct size, single channel, only allowed index values present."
  }
}