darknet/examples/detector.py
Daniel Gordon 3839d29309 merged
2018-03-13 11:26:27 -07:00

28 lines
783 B
Python

# Stupid python path shit.
# Instead just add darknet.py to somewhere in your python path
# OK actually that might not be a great idea, idk, work in progress
# Use at your own risk. or don't, i don't care
import sys, os
sys.path.append(os.path.join(os.getcwd(),'python/'))
import darknet as dn
import pdb
dn.set_gpu(0)
net = dn.load_net("cfg/yolo-thor.cfg", "/home/pjreddie/backup/yolo-thor_final.weights", 0)
meta = dn.load_meta("cfg/thor.data")
r = dn.detect(net, meta, "data/bedroom.jpg")
print r
# And then down here you could detect a lot more images like:
rr = dn.detect(net, meta, "data/eagle.jpg")
print rr
rr = dn.detect(net, meta, "data/giraffe.jpg")
print rr
rr = dn.detect(net, meta, "data/horses.jpg")
print rr
rr = dn.detect(net, meta, "data/person.jpg")
print rr