code: def __init__(
      self,
      cfg,
      opt,
      save_video=False,
      video_save_opt=DEFAULT_VIDEO_SAVE_OPT,
      queueSize=1024,
  ):
      self.cfg = cfg
      self.opt = opt
      self.video_save_opt = video_save_opt
  
      self.eval_joints = EVAL_JOINTS
      self.save_video = save_video
      self.heatmap_to_coord = get_func_heatmap_to_coord(cfg)
      # initialize the queue used to store frames read from
      # the video file
      if opt.sp:
          self.result_queue = Queue(maxsize=queueSize)
      else:
          self.result_queue = mp.Queue(maxsize=queueSize)
  
      if opt.save_img:
          if not os.path.exists(opt.outputpath + "/vis"):
              os.mkdir(opt.outputpath + "/vis")
  
      if opt.pose_flow:
          from trackers.PoseFlow.poseflow_infer import PoseFlowWrapper
  
          self.pose_flow_wrapper = PoseFlowWrapper(
              save_path=os.path.join(opt.outputpath, "poseflow")
          )
  
      if self.opt.save_img or self.save_video or self.opt.vis:
          loss_type = self.cfg.DATA_PRESET.get("LOSS_TYPE", "MSELoss")
          num_joints = self.cfg.DATA_PRESET.NUM_JOINTS
          if loss_type == "MSELoss":
              self.vis_thres = [0.4] * num_joints
          elif "JointRegression" in loss_type:
              self.vis_thres = [0.05] * num_joints
          elif loss_type == "Combined":
              if num_joints == 68:
                  hand_face_num = 42
              else:
                  hand_face_num = 110
              self.vis_thres = [0.4] * (num_joints - hand_face_num) + [
                  0.05
              ] * hand_face_num
  
      self.use_heatmap_loss = (
          self.cfg.DATA_PRESET.get("LOSS_TYPE", "MSELoss") == "MSELoss"
      )
  
      self.tracker = norfair.Tracker(
          distance_function=keypoints_distance,
          distance_threshold=0.3,
          detection_threshold=0.2,
      )
  
imports: import os
  import time
  from queue import Queue
  from threading import Thread
  import cv2
  import numpy
  import torch
  import torch.multiprocessing
  from alphapose.utils.pPose_nms import pose_nms, write_json
  from alphapose.utils.transforms import get_func_heatmap_to_coord
  import norfair
label_desc: Use image node_id 1 to create a new DataWriter object  with example: obj = DataWriter(cfg, opt, save_video, video_save_opt, queueSize)