You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working with the Detectron2 library and trying to extract specific information from the model's predictions. I have extracted detection scores, prediction boxes, and prediction classes successfully, but I am having trouble extracting the detected string values from the predicted text probabilities. Below is the relevant portion of my code:
# Extract information from predsdetection_scores=preds.get("scores")
pred_boxes=preds.get("pred_boxes")
pred_classes=preds.get("pred_classes")
text_probs=preds.get("pred_text_prob")
# Printing the extracted informationprint("\nDetection Scores:")
print(detection_scores)
print("\nPrediction Boxes:")
print(pred_boxes)
print("\nPrediction Classes:")
print(pred_classes)
print("\nText Probabilities:")
print(text_probs)
# Assuming the first prediction is the one you're interested indetected_number=pred_classes[0].item() iflen(pred_classes) >0elseNonedetection_score=detection_scores[0].item() iflen(detection_scores) >0elseNone# Attempting to get the highest text probability for the first predicted wordtext_score=text_probs[0].max().item() iflen(text_probs) >0elseNone# Print the saved valuesprint("\nDetected Number:", detected_number)
print("Detection Score:", detection_score)
print("Text Score:", text_score)
While this code executes without errors, it does not produce the desired result. Specifically, I am trying to obtain the detected string value (e.g., "18" as shown in the attached image) from the predicted text probabilities.
Request:
Could you guide how to correctly extract the detected string values from the predicted text probabilities? Any advice or code snippets would be greatly appreciated.
Additional Information:
Below are the extracted values from my model's predictions:
Description:
I am currently working with the Detectron2 library and trying to extract specific information from the model's predictions. I have extracted detection scores, prediction boxes, and prediction classes successfully, but I am having trouble extracting the detected string values from the predicted text probabilities. Below is the relevant portion of my code:
While this code executes without errors, it does not produce the desired result. Specifically, I am trying to obtain the detected string value (e.g., "18" as shown in the attached image) from the predicted text probabilities.
Request:
Could you guide how to correctly extract the detected string values from the predicted text probabilities? Any advice or code snippets would be greatly appreciated.
Additional Information:
Below are the extracted values from my model's predictions:
I appreciate your help!
The text was updated successfully, but these errors were encountered: