Closed 885narrow closed 1 year ago
I tested with some images by referring to the Using Pretrained Models for Predictions.
Take a look at this and let me know if it helps:
from super_gradients.common.object_names import Models
from super_gradients.training import models
import ntpath
model = models.get(Models.YOLO_NAS_L, pretrained_weights="coco")
IMAGES = [
"D:/super-gradients/images/image_person.bmp",
"D:/super-gradients/images/image_bus.jpg",
"D:/super-gradients/images/122021417432646.bmp",
]
images_predictions = model.predict(IMAGES, iou=0.5, conf=0.7)
for i, prediction in enumerate(images_predictions):
image_output_path = ntpath.join("output_folder", f"{ntpath.basename(IMAGES[i])}")
prediction.save(output_path=image_output_path)
Thank you very much, that's how it works.
💡 Your Question
Is it possible in model.prediction to use the original file name to store ? when accessing prediction results and something was predicted I want to save to same file name.
https://github.com/Deci-AI/super-gradients/blob/classification_predict/documentation/source/ModelPredictions.md
out.save() they are stored with new names pred_1.jpg etc.
access original file name as well here!:
`for image_prediction in images_predictions: class_names = image_prediction.class_names labels = image_prediction.prediction.labels confidence = image_prediction.prediction.confidence bboxes = image_prediction.prediction.bboxes_xyxy
Thank you for your help and time.
Versions
No response