darknet
v3
examples
detector.py
Go to the documentation of this file.
1
# Stupid python path shit.
2
# Instead just add darknet.py to somewhere in your python path
3
# OK actually that might not be a great idea, idk, work in progress
4
# Use at your own risk. or don't, i don't care
5
6
import
sys, os
7
sys.path.append(os.path.join(os.getcwd(),
'python/'
))
8
9
import
darknet
as
dn
10
import
pdb
11
12
dn.set_gpu(0)
13
net = dn.load_net(
"cfg/yolo-thor.cfg"
,
"/home/pjreddie/backup/yolo-thor_final.weights"
, 0)
14
meta = dn.load_meta(
"cfg/thor.data"
)
15
r = dn.detect(net, meta,
"data/bedroom.jpg"
)
16
print
r
17
18
# And then down here you could detect a lot more images like:
19
r = dn.detect(net, meta,
"data/eagle.jpg"
)
20
print
r
21
r = dn.detect(net, meta,
"data/giraffe.jpg"
)
22
print
r
23
r = dn.detect(net, meta,
"data/horses.jpg"
)
24
print
r
25
r = dn.detect(net, meta,
"data/person.jpg"
)
26
print
r
27
Generated by
1.8.13