label_evaluation Packageο
The label_evaluation package contains evaluation metrics and analysis tools for assessing system performance.
Package Contentsο
Modulesο
Accuracy Classifierο
- label_evaluation.accuracy_classifier.metrics(target, pred, gt, out_dir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/entomological-label-information-extraction/checkouts/latest/docs'))[source]
Build a text report showing the main classification metrics, to measure the quality of predictions of the classification model, and save it to a text file.
- label_evaluation.accuracy_classifier.cm(target, pred, gt, out_dir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/entomological-label-information-extraction/checkouts/latest/docs'), title='Classifier')[source]
Compute confusion matrix to evaluate the performance of the classification.
Text Evaluationο
- exception label_evaluation.evaluate_text.EmptyReferenceError(message=None)[source]
Bases:
ExceptionCustom exception for handling cases where the reference string is empty.
- label_evaluation.evaluate_text.calculate_cer(reference, hypothesis)[source]
Calculate the Character Error Rate (CER) between reference and hypothesis.
- label_evaluation.evaluate_text.get_gold_transcriptions(filename, sep=',')[source]
Load ground truth transcriptions from a CSV file into a dictionary.
- label_evaluation.evaluate_text.load_json_predictions(filename)[source]
Load predictions from a JSON file.
- label_evaluation.evaluate_text.calculate_scores(gold_text, predicted_text)[source]
Calculate Word Error Rate (WER) and Character Error Rate (CER) between ground truth and prediction.
- label_evaluation.evaluate_text.create_plot(data, score_name, file_name)[source]
Create and save a violin plot for the given error scores.
- label_evaluation.evaluate_text.evaluate_text_predictions(ground_truth_file, predictions_file, out_dir)[source]
Evaluate OCR predictions against a ground truth dataset.
IoU Scoresο
- label_evaluation.iou_scores.calculate_iou(pred_coords, gt_coords)[source]
Calculates Intersection over Union (IOU) scores by comparing predicted and ground truth segmentation coordinates.
- label_evaluation.iou_scores.comparison(df_pred_filename, df_gt_filename)[source]
Compare bounding box coordinates and calculate IOU scores.
- Parameters:
df_pred_filename (pd.DataFrame) β DataFrame with predicted labels.
df_gt_filename (pd.DataFrame) β DataFrame with ground truth labels.
- Returns:
DataFrame with added IOU scores.
- Return type:
pd.DataFrame
- label_evaluation.iou_scores.concat_frames(df_pred, df_gt)[source]
Concatenate predicted and ground truth datasets with IOU scores.
- Parameters:
df_pred (pd.DataFrame) β DataFrame with predicted bounding boxes.
df_gt (pd.DataFrame) β DataFrame with ground truth bounding boxes.
- Returns:
Concatenated DataFrame with calculated IOU scores.
- Return type:
pd.DataFrame
- label_evaluation.iou_scores.box_plot_iou(df_concat, accuracy_txt_path=None)[source]
Generate a box plot for IOU scores.
- Parameters:
df_concat (pd.DataFrame) β DataFrame with IOU scores.
accuracy_txt_path (str, optional) β Path to save accuracy percentages.
- Returns:
Plotly figure object.
- Return type:
go.Figure
Redundancy Analysisο
- label_evaluation.redundancy.clean_data(data)[source]
Preprocess the dataset by converting text to lowercase, removing punctuation and whitespace, and excluding entries containing βhttpβ.
- label_evaluation.redundancy.redundancy(data)[source]
Identify duplicate entries in a preprocessed dataset.