I need help with RoboflowEvaluator. I am trying to evaluate a computer vision model using cvevals by following this vlog, How to Evaluate Computer Vision Models with CVevals
This is my code which I erased my API key for privacy:
import argparse
import os
from roboflow import Roboflow
from evaluations.dataloaders import (RoboflowDataLoader,
RoboflowPredictionsDataLoader)
from evaluations.roboflow import RoboflowEvaluator
rf = Roboflow(api_key=“”)
project = rf.workspace().project(“final-grape-leaf-disease-detection-and-classification”)
model = project.version(15).model
EVAL_DATA_PATH = “/Users/green/OneDrive/Desktop/Code/YOLOFORPYTHON/data”
ROBOFLOW_WORKSPACE_URL = “thesis-t6sjh”
ROBOFLOW_PROJECT_URL = “final-grape-leaf-disease-detection-and-classification”
ROBOFLOW_MODEL_VERSION = 15
class_names = [“Healthy”, “Birds_Eye_Rot”, “Powdery_Mildew”]
class_names, data, model = RoboflowDataLoader(
workspace_url=ROBOFLOW_WORKSPACE_URL,
project_url=ROBOFLOW_PROJECT_URL,
project_version=ROBOFLOW_MODEL_VERSION,
image_files=EVAL_DATA_PATH,
).download_dataset()
predictions = RoboflowPredictionsDataLoader(
model=model,
model_type=“multiclass”,
image_files=EVAL_DATA_PATH,
class_names=class_names,
).process_files()
evaluator = RoboflowEvaluator(
model_type=“multiclass”,
ground_truth=data, predictions=predictions, class_names=class_names, mode=“batch”
)
cf = evaluator.eval_model_predictions()
print(cf)
data = evaluator.calculate_statistics()
print(“Precision:”, data.precision)
print(“Recall:”, data.recall)
print(“f1 Score:”, data.f1)
I keep getting this error:
Exception has occurred: KeyError
‘images\20230717_093620_jpg.rf.efbf9b981bda623c03ff65b3c8a52612.jpg’
File “C:\Users\green\OneDrive\Desktop\Code\testing.py”, line 35, in
evaluator = RoboflowEvaluator(
^^^^^^^^^^^^^^^^^^
KeyError: ‘images\20230717_093620_jpg.rf.efbf9b981bda623c03ff65b3c8a52612.jpg’
The image shown on the error is the first image of my dataset. What can I do to solve this issue? I have tried combining both the txt files and image files into one folder (One folder for test, one folder for train, and one folder for valid). For reference I will attach a pic.