mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
python stuff
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user