python stuff

This commit is contained in:
Daniel Gordon
2018-03-13 11:25:44 -07:00
parent d7088fdec1
commit 0158fb23b2
3 changed files with 35 additions and 20 deletions

View File

@@ -38,14 +38,18 @@ import darknet as dn
# Darknet
net = dn.load_net("cfg/tiny-yolo.cfg", "tiny-yolo.weights", 0)
meta = dn.load_meta("cfg/coco.data")
r = dn.detect(net, meta, "data/dog.jpg")
print r
import time
tStart = time.time()
for i in range(10):
r = dn.detect(net, meta, "data/dog.jpg")
print(time.time() - tStart)
# scipy
arr= imread('data/dog.jpg')
im = array_to_image(arr)
r = detect2(net, meta, im)
print r
tStart = time.time()
for i in range(10):
r = dn.detect(net, meta, arr)
print(time.time() - tStart)
# OpenCV
arr = cv2.imread('data/dog.jpg')

View File

@@ -9,20 +9,11 @@ sys.path.append(os.path.join(os.getcwd(),'python/'))
import darknet as dn
import pdb
<<<<<<< HEAD
net = dn.load_net("cfg/yolo-tag.cfg", "yolo-tag_final.weights", 0)
meta = dn.load_meta("cfg/openimages.data")
pdb.set_trace()
rr = dn.detect(net, meta, 'data/dog.jpg')
print rr
pdb.set_trace()
=======
dn.set_gpu(0)
net = dn.load_net("cfg/tiny-yolo.cfg", "tiny-yolo.weights", 0)
meta = dn.load_meta("cfg/coco.data")
r = dn.detect(net, meta, "data/dog.jpg")
print r
>>>>>>> 16686cec576580489ab3c7c78183e6efeafae780
# And then down here you could detect a lot more images like:
rr = dn.detect(net, meta, "data/eagle.jpg")