code: def load(self, filename):
      keys = [
          "version",
          "imageData",
          "imagePath",
          "shapes",  # polygonal annotations
          "flags",  # image level flags
          "imageHeight",
          "imageWidth",
      ]
      shape_keys = [
          "label",
          "points",
          "group_id",
          "shape_type",
          "flags",
      ]
      try:
          with open(filename, "r") as f:
              data = json.load(f)
          version = data.get("version")
          if version is None:
              logging.warning(
                  "Loading JSON file ({}) of unknown version".format(
                      filename
                  )
              )
          elif version.split(".")[0] != __version__.split(".")[0]:
              logging.warning(
                  "This JSON file ({}) may be incompatible with "
                  "current labelme. version in file: {}, "
                  "current version: {}".format(
                      filename, version, __version__
                  )
              )
  
          if data["imageData"] is not None:
              imageData = base64.b64decode(data["imageData"])
              if PY2 and QT4:
                  imageData = img_data_to_png_data(imageData)
          else:
              # relative path from label file to relative path from cwd
              imagePath = osp.join(
                  osp.dirname(filename), data["imagePath"]
              )
              imageData = self.load_image_file(imagePath)
          flags = data.get("flags") or {}
          imagePath = data["imagePath"]
          self._check_image_height_and_width(
              base64.b64encode(imageData).decode("utf-8"),
              data.get("imageHeight"),
              data.get("imageWidth"),
          )
          shapes = [
              dict(
                  label=s["label"],
                  points=s["points"],
                  shape_type=s.get("shape_type", "polygon"),
                  flags=s.get("flags", {}),
                  group_id=s.get("group_id"),
                  other_data={
                      k: v for k, v in s.items() if k not in shape_keys
                  },
              )
              for s in data["shapes"]
          ]
      except Exception as e:
          raise LabelFileError(e)
  
      otherData = {}
      for key, value in data.items():
          if key not in keys:
              otherData[key] = value
  
      # Only replace data after everything is loaded.
      self.flags = flags
      self.shapes = shapes
      self.imagePath = imagePath
      self.imageData = imageData
      self.filename = filename
      self.otherData = otherData
  
imports: import argparse
  import collections
  import datetime
  import glob
  import json
  import os
  import os.path
  import sys
  import uuid
  import PIL
  import io
  import base64
  import logging
  import math
  import imgviz
  import numpy
label_desc: Use image node_id 3 for calling the LabelFile obj's underlying member method code with example usage: obj.load(filename) without return types