Skip to content

"ValueError: array of sample points is empty" when using object_detection/evaluation #30

@mokoe004

Description

@mokoe004

When running evaluation operation mode with a YOLOv8 quantized model on a dataset in Darknet format (converted to .tsf), I encounter a crash during metrics calculation due to an empty array of sample points.

  • The dataset contains only the "person" class.
  • Model is from: stm-hotspot/ultralytics
  • The model works in other operation modes like deployment and prediction.

Configuration file:

general:
   model_path: ./pretrained_models/yolov8n_416_quant_pc_uf_od_coco-person-st.tflite
   model_type: yolo_v8
operation_mode: prediction

prediction:
  test_files_path: ./datasets/voc2012_person/test_files
  target: host # host, stedgeai_host, stedgeai_n6

evaluation:
  profile: profile_O3
  input_type: uint8     # int8 / uint8 / float32
  output_type: int8     # int8 / uint8 / float32
  input_chpos: chlast   # chlast / chfirst
  output_chpos: chlast  # chlast / chfirst
  target: host # host, stedgeai_host, stedgeai_n6

dataset:
  class_names: [person]
  test_path: ./datasets/voc2012_person/mini


preprocessing:
  rescaling: { scale: 1/255, offset: 0 }
  resizing:
    aspect_ratio: fit
    interpolation: nearest
  color_mode: rgb

postprocessing:
  confidence_thresh: 0.4
  NMS_thresh: 0.5
  IoU_eval_thresh: 0.5
  plot_metrics: True   # Plot precision versus recall curves. Default is False.
  max_detection_boxes: 100

tools:
   stedgeai:
      path_to_stedgeai: C:/ST/STEdgeAI/2.1/Utilities/windows/stedgeai.exe

mlflow:
   uri: ./src/experiments_outputs/mlruns

hydra:
   run:
      dir: ./src/experiments_outputs/${now:%Y_%m_%d_%H_%M_%S}

Error log:

Error executing job with overrides: []
Traceback (most recent call last):
  File "C:\Users\ibrak\PycharmProjects\stm32ai-modelzoo-services\venv\lib\site-packages\clearml\binding\hydra_bind.py", line 230, in _patched_task_function
    return task_function(a_config, *a_args, **a_kwargs)
  File "C:\Users\ibrak\PycharmProjects\stm32ai-modelzoo-services\object_detection\stm32ai_main.py", line 220, in main
    process_mode(cfg)
  File "C:\Users\ibrak\PycharmProjects\stm32ai-modelzoo-services\object_detection\stm32ai_main.py", line 69, in process_mode
    evaluate(cfg)
  File "C:\Users\ibrak\PycharmProjects\stm32ai-modelzoo-services\object_detection\src\evaluation\evaluate.py", line 353, in evaluate
    metrics = _evaluate_quantized_model(cfg, model_path, num_classes=num_classes, output_dir=output_dir)
  File "C:\Users\ibrak\PycharmProjects\stm32ai-modelzoo-services\object_detection\src\evaluation\evaluate.py", line 199, in _evaluate_quantized_model
    metrics = calculate_objdet_metrics(groundtruths, detections, cpp.IoU_eval_thresh)
  File "C:\Users\ibrak\PycharmProjects\stm32ai-modelzoo-services\object_detection\src\utils\objdet_metrics.py", line 291, in calculate_objdet_metrics
    irec = np.interp(-x, -conf, rec, left=0)
  File "<__array_function__ internals>", line 180, in interp
  File "C:\Users\ibrak\PycharmProjects\stm32ai-modelzoo-services\venv\lib\site-packages\numpy\lib\function_base.py", line 1594, in interp
    return interp_func(x, xp, fp, left, right)
ValueError: array of sample points is empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions