Comments (3)
I used all the keypoints from the hands in the CMU dataset and calculated the bounding box out of it.
from yolo-hand-detection.
Are you permitted to share the script you used? I'm trying to retrain YOLO from scratch and it would be extremely valuable!!
from yolo-hand-detection.
Have a look here, I guess this was script (already some time ago). Please adjust the dataset_name
variable to point to the correct dataset.
import glob
import os
import json
from scipy.io import loadmat
from PIL import Image
dataset_name = "test"
dataset = "data\\%s" % dataset_name
data = []
annotations = glob.glob("%s\\*.json" % dataset)
# create annotation dict
ann_map = {}
for ann in annotations:
key = os.path.splitext(os.path.basename(ann))[0][:-2]
if not key in ann_map:
ann_map[key] = []
ann_map[key].append(ann)
def load(file):
with open(file, 'r') as f:
return json.load(f)
def write(file, content):
with open(file, 'w') as outfile:
outfile.write(content)
def bounding_box(xs, ys):
x_min = min(xs)
x_max = max(xs)
y_min = min(ys)
y_max = max(ys)
w = x_max - x_min
h = y_max - y_min
return (x_min + (w/2), y_min + (h/2), w, h)
for key in ann_map:
anns = ann_map[key]
default_file = os.path.basename(ann_map[key][0])
default_file_name = os.path.splitext(default_file)[0]
im = Image.open("%s\\%s.jpg" % (dataset, default_file_name))
width = im.size[0]
height = im.size[1]
ann_txt = []
for annFile in anns:
filename = os.path.basename(annFile)
name = os.path.splitext(filename)[0]
detections = []
print(annFile)
desc = load(annFile)
keypoints = desc["hand_pts"]
xs = [l[0] for l in keypoints]
ys = [l[1] for l in keypoints]
x, y, w, h = bounding_box(xs, ys)
ann_txt.append("%s %s %s %s %s" % (0, x / width, y / height, w / width, h / height))
write("%s\\%s.txt" % (dataset, default_file_name), '\n'.join(ann_txt))
data.append("%s\\%s.jpg" % (dataset, default_file_name))
write("%s.txt" % dataset_name, '\n'.join(data))
print("done!")
from yolo-hand-detection.
Related Issues (19)
- Missing source code HOT 2
- How to retrain the model ? HOT 2
- No detection with webcam mode HOT 9
- How can I get every detected hand coordinate HOT 2
- the demo with v4-tiny modle can not work HOT 2
- Request for a license file addition for this project HOT 1
- Could you provide the training code for this hand detection project? HOT 5
- How to use the CMU Hand DB? HOT 2
- Datasets HOT 1
- Bound box is sometimes partially formed HOT 1
- Indexing of output layer names
- how to GPU Inference?
- Datasets: How to reconstruct HOT 1
- ZeroDivisionError: integer division or modulo by zero in demo.py HOT 1
- Convert cross-hands.weights model to grayscale model HOT 1
- Failed to parse NetParameter file HOT 6
- 准确率 有点低啊 HOT 1
- Conversion To TensorFlow or Keras HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolo-hand-detection.