{"action":"created","issue":{"url":"https://api.github.com/repos/pjreddie/darknet/issues/679","repository_url":"https://api.github.com/repos/pjreddie/darknet","labels_url":"https://api.github.com/repos/pjreddie/darknet/issues/679/labels{/name}","comments_url":"https://api.github.com/repos/pjreddie/darknet/issues/679/comments","events_url":"https://api.github.com/repos/pjreddie/darknet/issues/679/events","html_url":"https://github.com/pjreddie/darknet/issues/679","id":313240141,"number":679,"title":"请问darknet的python接口更新后，make_boxes...这几个函数用什么替代?","user":{"login":"notobject","id":29477374,"avatar_url":"https://avatars1.githubusercontent.com/u/29477374?v=4","gravatar_id":"","url":"https://api.github.com/users/notobject","html_url":"https://github.com/notobject","followers_url":"https://api.github.com/users/notobject/followers","following_url":"https://api.github.com/users/notobject/following{/other_user}","gists_url":"https://api.github.com/users/notobject/gists{/gist_id}","starred_url":"https://api.github.com/users/notobject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notobject/subscriptions","organizations_url":"https://api.github.com/users/notobject/orgs","repos_url":"https://api.github.com/users/notobject/repos","events_url":"https://api.github.com/users/notobject/events{/privacy}","received_events_url":"https://api.github.com/users/notobject/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-11T09:20:39Z","updated_at":"2018-04-12T03:32:57Z","closed_at":null,"author_association":"NONE","body":"## file: examples/detector-scipy-opencv.py\r\n```python\r\n# Stupid python path shit.\r\n# Instead just add darknet.py to somewhere in your python path\r\n# OK actually that might not be a great idea, idk, work in progress\r\n# Use at your own risk. or don't, i don't care\r\n\r\nfrom scipy.misc import imread\r\nimport cv2\r\nimport sys, os\r\nsys.path.append(os.path.join(os.getcwd(),'python/'))\r\nimport darknet as dn\r\n\r\ndef array_to_image(arr):\r\n    arr = arr.transpose(2,0,1)\r\n    c = arr.shape[0]\r\n    h = arr.shape[1]\r\n    w = arr.shape[2]\r\n    arr = (arr/255.0).flatten()\r\n    data = dn.c_array(dn.c_float, arr)\r\n    im = dn.IMAGE(w,h,c,data)\r\n    return im\r\n\r\ndef detect2(net, meta, image, thresh=.5, hier_thresh=.5, nms=.45):\r\n    boxes = dn.make_boxes(net)\r\n    probs = dn.make_probs(net)\r\n    num =   dn.num_boxes(net)\r\n    dn.network_detect(net, image, thresh, hier_thresh, nms, boxes, probs)\r\n    res = []\r\n    for j in range(num):\r\n        for i in range(meta.classes):\r\n            if probs[j][i] > 0:\r\n                res.append((meta.names[i], probs[j][i], (boxes[j].x, boxes[j].y, boxes[j].w, boxes[j].h)))\r\n    res = sorted(res, key=lambda x: -x[1])\r\n    dn.free_ptrs(dn.cast(probs, dn.POINTER(dn.c_void_p)), num)\r\n    return res\r\n\r\n\r\n\r\n# Darknet\r\nnet = dn.load_net(\"cfg/yolov3.cfg\", \"yolov3.weights\", 0)\r\nmeta = dn.load_meta(\"cfg/coco.data\")\r\n# r = dn.detect(net, meta, \"data/dog.jpg\")\r\n# print r\r\n\r\n# scipy\r\n# arr= imread('data/dog.jpg')\r\n# im = array_to_image(arr)\r\n# r = detect2(net, meta, im)\r\n# print r\r\n\r\n# OpenCV\r\ncap = cv2.VideoCapture(1)\r\nwhile True:\r\n    rect,frame = cap.read()\r\n    im = array_to_image(frame)\r\n    dn.rgbgr_image(im)\r\n    r = detect2(net, meta, im)\r\n    cv2.imshow(\"Demo\",frame)\r\n    print r\r\n\r\n```\r\n## Error Messgae\r\n```\r\n.....\r\n.....\r\nLoading weights from yolov3.weights...Done!\r\nTraceback (most recent call last):\r\n  File \"examples/detector-scipy-opencv.py\", line 56, in <module>\r\n    r = detect2(net, meta, im)\r\n  File \"examples/detector-scipy-opencv.py\", line 23, in detect2\r\n    boxes = dn.make_boxes(net)\r\nAttributeError: 'module' object has no attribute 'make_boxes'\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pjreddie/darknet/issues/comments/380667012","html_url":"https://github.com/pjreddie/darknet/issues/679#issuecomment-380667012","issue_url":"https://api.github.com/repos/pjreddie/darknet/issues/679","id":380667012,"user":{"login":"lwplw","id":13364100,"avatar_url":"https://avatars1.githubusercontent.com/u/13364100?v=4","gravatar_id":"","url":"https://api.github.com/users/lwplw","html_url":"https://github.com/lwplw","followers_url":"https://api.github.com/users/lwplw/followers","following_url":"https://api.github.com/users/lwplw/following{/other_user}","gists_url":"https://api.github.com/users/lwplw/gists{/gist_id}","starred_url":"https://api.github.com/users/lwplw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwplw/subscriptions","organizations_url":"https://api.github.com/users/lwplw/orgs","repos_url":"https://api.github.com/users/lwplw/repos","events_url":"https://api.github.com/users/lwplw/events{/privacy}","received_events_url":"https://api.github.com/users/lwplw/received_events","type":"User","site_admin":false},"created_at":"2018-04-12T03:32:57Z","updated_at":"2018-04-12T03:32:57Z","author_association":"NONE","body":"同问\r\n\r\n...\r\nTraceback (most recent call last):\r\n  File \"ship_demo.py\", line 5, in <module>\r\n    import darknet as dn\r\n  File \"/media/lwp/lwplw/lwptuthinkjoy/demo/darknet.py\", line 116, in <module>\r\n    make_boxes = lib.make_boxes\r\n  File \"/home/lwp/lwptuapp/anaconda3/lib/python3.6/ctypes/__init__.py\", line 361, in __getattr__\r\n    func = self.__getitem__(name)\r\n  File \"/home/lwp/lwptuapp/anaconda3/lib/python3.6/ctypes/__init__.py\", line 366, in __getitem__\r\n    func = self._FuncPtr((name_or_ordinal, self))\r\nAttributeError: libdarknet.so: undefined symbol: make_boxes"}}
{"actor":{"display_login":"lwplw"}}