Datasets:
Tasks:
Object Detection
Formats:
webdataset
Languages:
English
Size:
< 1K
ArXiv:
Tags:
webdataset
License:
Tony Fang
commited on
Commit
·
9388bc0
1
Parent(s):
4f89725
edited .pkl and added files to create the dir for obj detection
Browse files
.gitattributes
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
dataset_screenshot.png filter=lfs diff=lfs merge=lfs -text
|
| 2 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 1 |
dataset_screenshot.png filter=lfs diff=lfs merge=lfs -text
|
| 2 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
pmfeed_4_3_16_bboxes_and_labels.pkl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.png
|
| 2 |
+
*.jpg
|
| 3 |
+
*.out
|
| 4 |
+
*.pt
|
| 5 |
+
*submit.sh
|
| 6 |
+
*.txt
|
object_detector_benchmark/create_yolo_dataset.sh
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
mkdir 8_calves_yolo
|
| 4 |
+
mkdir 8_calves_yolo/train
|
| 5 |
+
mkdir 8_calves_yolo/val
|
| 6 |
+
mkdir 8_calves_yolo/test
|
| 7 |
+
mkdir 8_calves_yolo/train/labels
|
| 8 |
+
mkdir 8_calves_yolo/train/images
|
| 9 |
+
mkdir 8_calves_yolo/val/labels
|
| 10 |
+
mkdir 8_calves_yolo/val/images
|
| 11 |
+
cp ../hand_labelled_frames/amfeed_4_3_*png 8_calves_yolo/val/images
|
| 12 |
+
cp ../hand_labelled_frames/amfeed_[2-3]_3_*png 8_calves_yolo/train/images
|
| 13 |
+
cp ../hand_labelled_frames/pmfeed_[1-3]_3_*png 8_calves_yolo/train/images
|
| 14 |
+
cp ../hand_labelled_frames/amfeed_4_3_*txt 8_calves_yolo/val/labels
|
| 15 |
+
cp ../hand_labelled_frames/amfeed_[2-3]_3_*txt 8_calves_yolo/train/labels
|
| 16 |
+
cp ../hand_labelled_frames/pmfeed_[1-3]_3_*txt 8_calves_yolo/train/labels
|
| 17 |
+
|
object_detector_benchmark/create_yolo_testset.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cv2
|
| 2 |
+
import os
|
| 3 |
+
import pandas as pd
|
| 4 |
+
from tqdm import tqdm
|
| 5 |
+
# Path to the input video
|
| 6 |
+
video_path = "../pmfeed_4_3_16.mp4"
|
| 7 |
+
|
| 8 |
+
# Directory to save frames
|
| 9 |
+
output_dir = "8_calves_yolo/test/images"
|
| 10 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 11 |
+
|
| 12 |
+
# Load the video
|
| 13 |
+
video_capture = cv2.VideoCapture(video_path)
|
| 14 |
+
frame_number = 1
|
| 15 |
+
with tqdm(total=67760, desc="Extracting Frames") as pbar:
|
| 16 |
+
while True:
|
| 17 |
+
# Read the frame
|
| 18 |
+
ret, frame = video_capture.read()
|
| 19 |
+
# If no frame is returned, the video has ended
|
| 20 |
+
if not ret:
|
| 21 |
+
break
|
| 22 |
+
|
| 23 |
+
# Save the frame with a sequential name
|
| 24 |
+
frame_filename = os.path.join(output_dir, f"frame_{frame_number:05d}.png")
|
| 25 |
+
cv2.imwrite(frame_filename, frame)
|
| 26 |
+
|
| 27 |
+
# Increment the frame number
|
| 28 |
+
frame_number += 1
|
| 29 |
+
pbar.update(1)
|
| 30 |
+
# Release the video capture
|
| 31 |
+
video_capture.release()
|
| 32 |
+
|
| 33 |
+
print(f"Frames saved to: {output_dir}")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
output_dir = "8_calves_yolo/test/labels"
|
| 37 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 38 |
+
df = pd.read_pickle("../pmfeed_4_3_16_bboxes_and_labels.pkl")
|
| 39 |
+
df.reset_index(drop=True, inplace=True)
|
| 40 |
+
i = 0
|
| 41 |
+
j = 0
|
| 42 |
+
frame_id = 1
|
| 43 |
+
with tqdm(total=len(df)) as pbar:
|
| 44 |
+
while i < len(df):
|
| 45 |
+
while j < len(df) and df.loc[j]["frame_id"] == df.loc[i]["frame_id"]:
|
| 46 |
+
j += 1
|
| 47 |
+
pbar.update(1)
|
| 48 |
+
|
| 49 |
+
temp = df.loc[i:j - 1]
|
| 50 |
+
temp.to_csv(
|
| 51 |
+
f'{output_dir}/frame_{frame_id:05d}.txt',
|
| 52 |
+
header=None,
|
| 53 |
+
index=None,
|
| 54 |
+
sep=" ",
|
| 55 |
+
mode="w",
|
| 56 |
+
columns=["class", "x", "y", "w", "h"]
|
| 57 |
+
)
|
| 58 |
+
frame_id += 1
|
| 59 |
+
i = j
|
| 60 |
+
print(f"Labels saved to: {output_dir}")
|