{ "info": { "author": "Explosion AI", "author_email": "contact@explosion.ai", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Programming Language :: Cython", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering" ], "description": "LightNet: Bringing pjreddie's DarkNet out of the shadows\n********************************************************\n\nLightNet provides a simple and efficient Python interface to\n`DarkNet `_, a neural network library\nwritten by Joseph Redmon that's well known for its state-of-the-art object\ndetection models, `YOLO and YOLOv2 `_.\nLightNet's main purpose for now is to power `Prodigy `_'s\nupcoming object detection and image segmentation features. However, it may be\nuseful to anyone interested in the DarkNet library.\n\n.. image:: https://img.shields.io/travis/explosion/lightnet/master.svg?style=flat-square\n :target: https://travis-ci.org/explosion/lightnet\n :alt: Build Status\n\n.. image:: https://img.shields.io/github/release/explosion/lightnet.svg?style=flat-square\n :target: https://github.com/explosion/lightnet/releases\n :alt: Current Release Version\n\n.. image:: https://img.shields.io/pypi/v/lightnet.svg?style=flat-square\n :target: https://pypi.python.org/pypi/lightnet\n :alt: pypi Version\n\n.. image:: https://img.shields.io/twitter/follow/explosion_ai.svg?style=social&label=Follow\n :target: https://twitter.com/explosion_ai\n :alt: Explosion AI on Twitter\n\n----\n\nLightNet's features include:\n\n* **State-of-the-art object detection**: YOLOv2 offers unmatched speed/accuracy trade-offs.\n* **Easy-to-use via Python**: Pass in byte strings, get back numpy arrays with bounding boxes.\n* **Lightweight and self-contained**: No dependency on large frameworks like Tensorflow, PyTorch etc. The DarkNet source is provided in the package.\n* **Easy to install**: Just ``pip install lightnet`` and ``python -m lightnet download yolo``.\n* **Cross-platform**: Works on OSX and Linux, on Python 2.7, 3.5 and 3.6.\n* **10x faster on CPU**: Uses BLAS for its matrix multiplications routines.\n* **Not named DarkNet**: Avoids some potentially awkward misunderstandings.\n\n.. image:: https://user-images.githubusercontent.com/13643239/33104476-a31678ce-cf28-11e7-993f-872f3234f4b5.png\n :alt: LightNet \"logo\"\n\n\ud83c\udf13 Installation\n===============\n\n==================== ===\n**Operating system** macOS / OS X, Linux (Windows coming soon)\n**Python version** CPython 2.7, 3.5, 3.6. Only 64 bit.\n**Package managers** pip (source packages only)\n==================== ===\n\nLightNet can be installed via pip:\n\n.. code:: bash\n\n pip install lightnet\n\nOnce you've downloaded LightNet, you can install a model using the\n``lightnet download`` command. This will save the models in the\n``lightnet/data`` directory. If you've installed LightNet system-wide, make\nsure to run the command as administrator.\n\n.. code:: bash\n\n python -m lightnet download tiny-yolo\n python -m lightnet download yolo\n\nThe following models are currently available via the ``download`` command:\n\n===================== ======= ===\n``yolo.weights`` 258 MB `Direct download`__\n``tiny-yolo.weights`` 44.9 MB `Direct download`__\n===================== ======= ===\n\n__ https://pjreddie.com/media/files/yolo.weights\n__ https://pjreddie.com/media/files/tiny-yolo.weights\n\n\ud83c\udf13 Usage\n========\n\nAn object detection system predicts labelled bounding boxes on an image. The\nlabel scheme comes from the training data, so different models will have\ndifferent label sets. `YOLOv2 `_ can detect\nobjects in images of any resolution. Smaller images will be faster to predict,\nwhile high resolution images will give you better object detection accuracy.\n\nImages can be loaded by file-path, by JPEG-encoded byte-string, or by numpy\narray. If passing in a numpy array, it should be of dtype float32, and shape\n``(width, height, colors)``.\n\n.. code:: python\n\n import lightnet\n\n model = lightnet.load('tiny-yolo')\n image = lightnet.Image.from_bytes(open('eagle.jpg', 'rb').read())\n boxes = model(image)\n\n``METHOD`` lightnet.load\n------------------------\n\nLoad a pre-trained model. If a ``path`` is provided, it shoud be a directory\ncontaining two files, named ``{name}.weights`` and ``{name}.cfg``. If a\n``path`` is not provided, the built-in data directory is used, which is\nlocated within the LightNet package.\n\n.. code:: python\n\n model = lightnet.load('tiny-yolo')\n model = lightnet.load(path='/path/to/yolo')\n\n=========== =========== ===========\nArgument Type Description\n=========== =========== ===========\n``name`` unicode Name of the model located in the data directory, e.g. ``tiny-yolo``.\n``path`` unicode Optional path to a model data directory.\n**RETURNS** ``Network`` The loaded model.\n=========== =========== ===========\n\n----\n\n\ud83c\udf13 Network\n==========\n\nThe neural network object. Wraps DarkNet's ``network`` struct.\n\n``CLASSMETHOD`` Network.load\n----------------------------\n\nLoad a pre-trained model. Identical to ``lightnet.load()``.\n\n``METHOD`` Network.__call__\n---------------------------\n\nDetect bounding boxes given an ``Image`` object. The bounding boxes are\nprovided as a list, with each entry\n``(class_id, class_name, prob, [(x, y, width, height)])``, where ```x``` and\n``y``` are the pixel coordinates of the center of the centre of the box, and\n``width`` and ``height`` describe its dimensions. ``class_id`` is the integer\nindex of the object type, class_name is a string with the object type, and\n``prob`` is a float indicating the detection score. The ``thresh`` parameter\ncontrols the prediction threshold. Objects with a detection probability above\n``thresh`` are returned. We don't know what ``hier_thresh`` or ``nms`` do.\n\n.. code:: python\n\n boxes = model(image, thresh=0.5, hier_thresh=0.5, nms=0.45)\n\n=============== =========== ===========\nArgument Type Description\n=============== =========== ===========\n``image`` ``Image`` The image to process.\n``thresh`` float Prediction threshold.\n``hier_thresh`` float\n``path`` unicode Optional path to a model data directory.\n**RETURNS** list The bounding boxes, as ``(class_id, class_name, prob, xywh)`` tuples.\n=============== =========== ===========\n\n``METHOD`` Network.update\n-------------------------\n\nUpdate the model, on a batch of examples. The images should be provided as a\nlist of ``Image`` objects. The ``box_labels`` should be a list of ``BoxLabel``\nobjects. Returns a float, indicating how much the models prediction differed\nfrom the provided true labels.\n\n.. code:: python\n\n loss = model.update([image1, image2], [box_labels1, box_labels2])\n\n============== =========== ===========\nArgument Type Description\n============== =========== ===========\n``images`` list List of ``Image`` objects.\n``box_labels`` list List of ``BoxLabel`` objects.\n**RETURNS** float The loss indicating how much the prediction differed from the provided labels.\n============== =========== ===========\n\n----\n\n\ud83c\udf13 Image\n========\n\nData container for a single image. Wraps DarkNet's ``image`` struct.\n\n``METHOD`` Image.__init__\n-------------------------\n\nCreate an image. `data` should be a numpy array of dtype float32, and shape\n(width, height, colors).\n\n.. code:: python\n\n image = Image(data)\n\n=========== =========== ===========\nArgument Type Description\n=========== =========== ===========\n``data`` numpy array The image data\n**RETURNS** ``Image`` The newly constructed object.\n=========== =========== ===========\n\n``CLASSMETHOD`` Image.blank\n---------------------------\n\nCreate a blank image, of specified dimensions.\n\n.. code:: python\n\n image = Image.blank(width, height, colors)\n\n=========== =========== ===========\nArgument Type Description\n=========== =========== ===========\n``width`` int The image width, in pixels.\n``height`` int The image height, in pixels.\n``colors`` int The number of color channels (usually ``3``).\n**RETURNS** ``Image`` The newly constructed object.\n=========== =========== ===========\n\n``CLASSMETHOD`` Image.load\n--------------------------\n\nLoad an image from a path to a jpeg file, of the specified dimensions.\n\n.. code:: python\n\n image = Image.load(path, width, height, colors)\n\n=========== =========== ===========\nArgument Type Description\n=========== =========== ===========\n``path`` unicode The path to the image file.\n``width`` int The image width, in pixels.\n``height`` int The image height, in pixels.\n``colors`` int The number of color channels (usually ``3``).\n**RETURNS** ``Image`` The newly constructed object.\n=========== =========== ===========\n\n``CLASSMETHOD`` Image.from_bytes\n--------------------------------\n\nRead an image from a byte-string, which should be the contents of a jpeg file.\n\n.. code:: python\n\n image = Image.from_bytes(bytes_data)\n\n============== =========== ===========\nArgument Type Description\n============== =========== ===========\n``bytes_data`` bytes The image contents.\n**RETURNS** ``Image`` The newly constructed object.\n============== =========== ===========\n\n----\n\n\ud83c\udf13 BoxLabels\n============\n\nData container for labelled bounding boxes for a single image. Wraps an array\nof DarkNet's ``box_label`` struct.\n\n``METHOD`` BoxLabels.__init__\n-----------------------------\n\nLabelled box annotations for a single image, used to update the model. ``ids``\nshould be a 1d numpy array of dtype int32, indicating the correct class IDs of\nthe objects. ``boxes`` should be a 2d array of dtype float32, and shape\n``(len(ids), 4)``. The 4 columns of the boxes should provide the **relative**\n``x, y, width, height`` of the bounding box, where ``x`` and ``y`` are the\ncoordinates of the centre, relative to the image size, and ``width`` and\n``height`` are the relative dimensions of the box.\n\n.. code:: python\n\n box_labels = BoxLabels(ids, boxes)\n\n============== ============= ===========\nArgument Type Description\n============== ============= ===========\n``ids`` numpy array The class IDs of the objects.\n``boxes`` numpy array The boxes providing the relative ``x, y, width, height`` of the bounding box.\n**RETURNS** ``BoxLabels`` The newly constructed object.\n============== ============= ===========\n\n``CLASSMETHOD`` BoxLabels.load\n------------------------------\n\nLoad annotations for a single image from a text file. Each box should be\ndescribed on a single line, in the format ``class_id x y width height``.\n\n.. code:: python\n\n box_labels = BoxLabels.load(path)\n\n============== ============= ===========\nArgument Type Description\n============== ============= ===========\n``path`` unicode The path to load from.\n**RETURNS** ``BoxLabels`` The newly constructed object.\n============== ============= ===========", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://explosion.ai", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lightnet", "package_url": "https://pypi.org/project/lightnet/", "platform": "", "project_url": "https://pypi.org/project/lightnet/", "project_urls": { "Homepage": "https://explosion.ai" }, "release_url": "https://pypi.org/project/lightnet/0.0.13/", "requires_dist": null, "requires_python": "", "summary": "Bringing pjreddie's DarkNet out of the shadows", "version": "0.0.13" }, "last_serial": 3403142, "releases": { "0.0.10": [ { "comment_text": "", "digests": { "md5": "f0e80b478015a1b7070c1cde126d976d", "sha256": "76731f7db201e2f01fb9173c7f09b1acd814b35224465955d5a5bb52d3292754" }, "downloads": -1, "filename": "lightnet-0.0.10.tar.gz", "has_sig": false, "md5_digest": "f0e80b478015a1b7070c1cde126d976d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 342470, "upload_time": "2017-12-01T00:34:11", "url": "https://files.pythonhosted.org/packages/a7/82/b889c85359bc871044ed84a4b9fd24f9ec77f611958cb24bfa13624388bd/lightnet-0.0.10.tar.gz" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "2aa669fa235ce41518b551530b806d51", "sha256": "f6b3a1f89f390771fa9afe28096c11e3973a496ddf1715fd4d3d33fdb01abbda" }, "downloads": -1, "filename": "lightnet-0.0.11.tar.gz", "has_sig": false, "md5_digest": "2aa669fa235ce41518b551530b806d51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 358424, "upload_time": "2017-12-07T07:57:10", "url": "https://files.pythonhosted.org/packages/e8/58/9b51ef2f3db74e8600d0e0bcff8a7eded275e728380a700823a26276fecc/lightnet-0.0.11.tar.gz" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "0b487e81323b6c0262449fb3328f3814", "sha256": "53268e5e81f99797251c43d3a5017c4426acd2b08f396e48f050dfb463de66e8" }, "downloads": -1, "filename": "lightnet-0.0.12.tar.gz", "has_sig": false, "md5_digest": "0b487e81323b6c0262449fb3328f3814", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 365274, "upload_time": "2017-12-08T13:24:46", "url": "https://files.pythonhosted.org/packages/fb/5f/ace05136d21464e2cb47feb071c69f38aea8df256695949e3495519ee681/lightnet-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "ad6999af7d8e53928cf96d026b01cdc3", "sha256": "c67c9dc9d2639bafb86b9a880369b13f4d22e30b3795fa96410190104ba48277" }, "downloads": -1, "filename": "lightnet-0.0.13.tar.gz", "has_sig": false, "md5_digest": "ad6999af7d8e53928cf96d026b01cdc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 365446, "upload_time": "2017-12-09T08:51:17", "url": "https://files.pythonhosted.org/packages/df/dd/2d3e21088425d6d1e2b9e11e2c9583209f27399a50545f6ab5fc4ef4b70f/lightnet-0.0.13.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "25a89c62057af9e18a093319299b1e42", "sha256": "699fdc25d499f42296ca5f9a1eb4c1b32531702f7b19a63ffdf32f83539714c5" }, "downloads": -1, "filename": "lightnet-0.0.7.tar.gz", "has_sig": false, "md5_digest": "25a89c62057af9e18a093319299b1e42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 339668, "upload_time": "2017-11-22T05:23:22", "url": "https://files.pythonhosted.org/packages/ca/e4/4534ec331c60b77a295bcf22cb3b170663a40e5c3a74005c0743c6979f56/lightnet-0.0.7.tar.gz" } ], "0.0.7.dev0": [ { "comment_text": "", "digests": { "md5": "70ff8e0a245476e1bc7cccd6ad3a6a6d", "sha256": "1df8c9d3e82610f1de499ca588d8ef8a12fe5275ca1f87c769213027fee6a41f" }, "downloads": -1, "filename": "lightnet-0.0.7.dev0.tar.gz", "has_sig": false, "md5_digest": "70ff8e0a245476e1bc7cccd6ad3a6a6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 339629, "upload_time": "2017-11-22T03:31:22", "url": "https://files.pythonhosted.org/packages/84/10/da82739edada8f2787ceae0dcb9e3cb62c66c295e446f9cbda66f68485cb/lightnet-0.0.7.dev0.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "3f010a55b5d44249f82a3ea88c14c504", "sha256": "de84b9bd109aa2d26c4c5ff9590adf2dc38ed961376364bd3a74de970ca91f10" }, "downloads": -1, "filename": "lightnet-0.0.8.tar.gz", "has_sig": false, "md5_digest": "3f010a55b5d44249f82a3ea88c14c504", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 334363, "upload_time": "2017-11-23T10:51:26", "url": "https://files.pythonhosted.org/packages/ce/c2/c812965f1a94a42c6423a9d8c0a9d424dc354a2717062de85647812164dc/lightnet-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "367867339b21ec3be16a75768f295833", "sha256": "24dd9b1c86b253560b72fa050f745f4c8a88cf2c6fd6f075cc12829fa46f6d60" }, "downloads": -1, "filename": "lightnet-0.0.9.tar.gz", "has_sig": false, "md5_digest": "367867339b21ec3be16a75768f295833", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 336578, "upload_time": "2017-11-26T18:48:44", "url": "https://files.pythonhosted.org/packages/20/23/33b4fa69624d3be5f31bd054fb8c37b5c0285f09c1eb684a4efcd6438694/lightnet-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad6999af7d8e53928cf96d026b01cdc3", "sha256": "c67c9dc9d2639bafb86b9a880369b13f4d22e30b3795fa96410190104ba48277" }, "downloads": -1, "filename": "lightnet-0.0.13.tar.gz", "has_sig": false, "md5_digest": "ad6999af7d8e53928cf96d026b01cdc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 365446, "upload_time": "2017-12-09T08:51:17", "url": "https://files.pythonhosted.org/packages/df/dd/2d3e21088425d6d1e2b9e11e2c9583209f27399a50545f6ab5fc4ef4b70f/lightnet-0.0.13.tar.gz" } ] }