You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
718 B

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. import sys, os
  6. sys.path.append(os.path.join(os.getcwd(),'python/'))
  7. import darknet as dn
  8. net = dn.load_net("cfg/tiny-yolo.cfg", "tiny-yolo.weights", 0)
  9. meta = dn.load_meta("cfg/coco.data")
  10. r = dn.detect(net, meta, "data/dog.jpg")
  11. print r
  12. # And then down here you could detect a lot more images like:
  13. r = dn.detect(net, meta, "data/eagle.jpg")
  14. print r
  15. r = dn.detect(net, meta, "data/giraffe.jpg")
  16. print r
  17. r = dn.detect(net, meta, "data/horses.jpg")
  18. print r
  19. r = dn.detect(net, meta, "data/person.jpg")
  20. print r