Update app.py
Browse files
app.py
CHANGED
|
@@ -50,13 +50,12 @@ def generate_journal_with_images(video_path):
|
|
| 50 |
# Make predictions using YOLOv10 on the current frame
|
| 51 |
results = model.predict(source=frame_rgb, device=device)
|
| 52 |
|
| 53 |
-
#
|
| 54 |
-
|
| 55 |
-
result.render() # Render the results on the image (modifies the frame in-place)
|
| 56 |
|
| 57 |
-
# Save the image
|
| 58 |
frame_filename = os.path.join(output_folder, f"frame_{frame_count}.jpg")
|
| 59 |
-
cv2.imwrite(frame_filename,
|
| 60 |
saved_images.append(frame_filename)
|
| 61 |
|
| 62 |
# Extract labels (class indices) and map them to class names
|
|
|
|
| 50 |
# Make predictions using YOLOv10 on the current frame
|
| 51 |
results = model.predict(source=frame_rgb, device=device)
|
| 52 |
|
| 53 |
+
# Plot bounding boxes and labels on the image
|
| 54 |
+
annotated_frame = results[0].plot() # Plot detection results on the frame
|
|
|
|
| 55 |
|
| 56 |
+
# Save the annotated image
|
| 57 |
frame_filename = os.path.join(output_folder, f"frame_{frame_count}.jpg")
|
| 58 |
+
cv2.imwrite(frame_filename, annotated_frame[:, :, ::-1]) # Convert back to BGR for saving
|
| 59 |
saved_images.append(frame_filename)
|
| 60 |
|
| 61 |
# Extract labels (class indices) and map them to class names
|