nagasurendra commited on
Commit
4f24d2e
·
verified ·
1 Parent(s): 8aebf1e

Delete core_pipeline.py

Browse files
Files changed (1) hide show
  1. core_pipeline.py +0 -40
core_pipeline.py DELETED
@@ -1,40 +0,0 @@
1
- import cv2
2
- import os
3
- import tempfile
4
- import numpy as np
5
- from ultralytics import YOLO
6
- import matplotlib.pyplot as plt
7
-
8
-
9
-
10
-
11
- # Load YOLOv8 model (you can replace with your custom tree model)
12
- model = YOLO("./data/best.pt") # Replace with tree-trained model
13
-
14
-
15
- def extract_frames(video_path, interval=30):
16
- cap = cv2.VideoCapture(video_path)
17
- frames = []
18
- idx = 0
19
- while True:
20
- ret, frame = cap.read()
21
- if not ret:
22
- break
23
- if idx % interval == 0:
24
- frames.append(frame)
25
- idx += 1
26
- cap.release()
27
- return frames
28
-
29
- def detect_trees(frame):
30
- results = model(frame)
31
- bboxes = results[0].boxes.xyxy.cpu().numpy()
32
- confs = results[0].boxes.conf.cpu().numpy()
33
- labels = results[0].boxes.cls.cpu().numpy()
34
- return frame, bboxes, confs, labels
35
-
36
- def plot_detections(frame, bboxes):
37
- for box in bboxes:
38
- x1, y1, x2, y2 = box.astype(int)
39
- cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
40
- return frame