{ "info": { "author": "Shunta Saito", "author_email": "shunta.saito@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "PyNVVL\n======\n[![pypi-pynvvl-cuda80](https://img.shields.io/pypi/v/pynvvl-cuda80.svg)](https://pypi.org/project/pynvvl-cuda80)\n[![pypi-pynvvl-cuda90](https://img.shields.io/pypi/v/pynvvl-cuda90.svg)](https://pypi.org/project/pynvvl-cuda90)\n[![pypi-pynvvl-cuda91](https://img.shields.io/pypi/v/pynvvl-cuda91.svg)](https://pypi.org/project/pynvvl-cuda91)\n[![pypi-pynvvl-cuda92](https://img.shields.io/pypi/v/pynvvl-cuda92.svg)](https://pypi.org/project/pynvvl-cuda92)\n[![GitHub license](https://img.shields.io/github/license/mitmul/pynvvl.svg)](https://github.com/mitmul/pynvvl)\n\nPyNVVL is a thin wrapper of [NVIDIA Video Loader (NVVL)](https://github.com/NVIDIA/nvvl). This package enables you to load videos directoly to GPU memory and access them as [CuPy](https://github.com/cupy/cupy) ndarrays with zero copy. The pre-built binaries of PyNVVL include NVVL itself, so you do not need to install NVVL.\n\n## Requirements\n\n- CUDA 8.0, 9.0, 9.1, or 9.2\n- Python 2.7.6+, 3.4.7+, 3.5.1+, or 3.6.0+\n- [CuPy](https://github.com/cupy/cupy) v4.5.0\n\n## Tested Environment\n\n- Ubuntu 16.04\n- Python 2.7.6+, 3.4.7+, 3.5.1+, and 3.6.0+\n- CUDA 8.0, 9.0, 9.1, and 9.2\n\n## Install the pre-built binary\n\nPlease choose a right package depending on your CUDA version.\n\n```bash\n# [For CUDA 8.0]\npip install pynvvl-cuda80\n\n# [For CUDA 9.0]\npip install pynvvl-cuda90\n\n# [For CUDA 9.1]\npip install pynvvl-cuda91\n\n# [For CUDA 9.2]\npip install pynvvl-cuda92\n```\n\n## Usage\n\n```python\nimport pynvvl\nimport matplotlib.pyplot as plt\n\n# Create NVVLVideoLoader object\nloader = pynvvl.NVVLVideoLoader(device_id=0, log_level='error')\n\n# Show the number of frames in the video\nn_frames = loader.frame_count('examples/sample.mp4')\nprint('Number of frames:', n_frames)\n\n# Load a video and return it as a CuPy array\nvideo = loader.read_sequence(\n 'examples/sample.mp4',\n horiz_flip=True,\n scale_height=512,\n scale_width=512,\n crop_y=60,\n crop_height=385,\n crop_width=512,\n scale_method='Linear',\n normalized=True\n)\n\nprint(video.shape) # => (91, 3, 385, 512): (n_frames, channels, height, width)\nprint(video.dtype) # => float32\n\n# Get the first frame as numpy array\nframe = video[0].get()\nframe = frame.transpose(1, 2, 0)\n\nplt.imshow(frame)\nplt.savefig('examples/sample.png')\n```\n\n![](https://github.com/mitmul/pynvvl/raw/master/examples/sample.png)\n\nThis video is `flickr-2-6-3-3-5-2-7-6-5626335276_4.mp4` from the Moments-In-Time dataset.\n\nNote that cropping is performed after scaling. In the above example, NVVL performs scaling up from 256 x 256 to 512 x 512 first, then cropping the region [60:60 + 385, 0:512]. See the following section to know more about the transformation options.\n\n## VideoLoader options\n\nPlease specify the GPU device id when you create a `NVVLVideoLoader` object.\nYou can also specify the logging level with a argument `log_level` for the constructor of `NVVLVideoLoader`.\n\n```\nWrapper of NVVL VideoLoader\n\n Args:\n device_id (int): Specify the device id used to load a video.\n log_level (str): Logging level which should be either 'debug',\n 'info', 'warn', 'error', or 'none'.\n Logs with levels >= log_level is shown. The default is 'warn'.\n```\n\n## Transformation Options\n\n`pynvvl.NVVLVideoLoader.read_sequence` can take some options to specify the color space, the value range, and what transformations you want to perform to the video.\n\n```\nLoads the video from disk and returns it as a CuPy ndarray.\n\n Args:\n filename (str): The path to the video.\n frame (int): The initial frame number of the returned sequence.\n Default is 0.\n count (int): The number of frames of the returned sequence.\n If it is None, whole frames of the video are loaded.\n channels (int): The number of color channels of the video.\n Default is 3.\n scale_height (int): The height of the scaled video.\n Note that scaling is performed before cropping.\n If it is 0 no scaling is performed. Default is 0.\n scale_width (int): The width of the scaled video.\n Note that scaling is performed before cropping.\n If it is 0, no scaling is performed. Default is 0.\n crop_x (int): Location of the crop within the scaled frame.\n Must be set such that crop_y + height <= original height.\n Default is 0.\n crop_y (int): Location of the crop within the scaled frame.\n Must be set such that crop_x + width <= original height.\n Default is 0.\n crop_height (int): The height of cropped region of the video.\n If it is None, no cropping is performed. Default is None.\n crop_width (int): The width of cropped region of the video.\n If it is None, no cropping is performed. Default is None.\n scale_method (str): Scaling method. It should be either of\n 'Nearest' or 'Lienar'. Default is 'Linear'.\n horiz_flip (bool): Whether horizontal flipping is performed or not.\n Default is False.\n normalized (bool): If it is True, the values of returned video is\n normalized into [0, 1], otherwise the value range is [0, 255].\n Default is False.\n color_space (str): The color space of the values of returned video.\n It should be either 'RGB' or 'YCbCr'. Default is 'RGB'.\n chroma_up_method (str): How the chroma channels are upscaled from\n yuv 4:2:0 to 4:4:4. It should be 'Linear' currently.\n out (cupy.ndarray): Alternate output array where place the result.\n It must have the same shape and the dtype as the expected\n output, and its order must be C-contiguous.\n```\n\n## How to build\n\n### Build wheels using Docker: \n\nRequirements:\n\n- Docker\n- nvidia-docker (v1/v2)\n\n```\nbash docker/build_wheels.sh\n```\n\n### Setup development environment without Docker:\n\nThe `setup.py` script searches for necessary libraries.\n\nRequirements: the following libraries are available in `LIBRARY_PATH`.\n\n- libnvvl.so\n- libavformat.so.57\n- libavfilter.so.6\n- libavcodec.so.57\n- libavutil.so.55\n\nYou can build `libnvvl.so` in the `nvvl` repository. Follow the instructions\nof `nvvl` library. The `build` directory must be in `LIBRARY_PATH`.\n\nOther three libraries are available as packages in Ubuntu 16.04.\nThey are installed under `/usr/lib/x86_64-linux-gnu`, so they must be in `LIBRARY_PATH` as well.\n\n```\npython setup.py develop\npython setup.py bdist_wheel\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mitmul/pynvvl", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "pynvvl-cuda92", "package_url": "https://pypi.org/project/pynvvl-cuda92/", "platform": "", "project_url": "https://pypi.org/project/pynvvl-cuda92/", "project_urls": { "Homepage": "https://github.com/mitmul/pynvvl" }, "release_url": "https://pypi.org/project/pynvvl-cuda92/0.0.3a2/", "requires_dist": [ "cupy-cuda92 (>=4.5.0)" ], "requires_python": "", "summary": "PyNVVL: A Python wrapper for NVIDIA Video Loader (NVVL) with CuPy", "version": "0.0.3a2" }, "last_serial": 4785187, "releases": { "0.0.3a1": [ { "comment_text": "", "digests": { "md5": "98950e798ecd7fb4b7d8e0f93283d2cd", "sha256": "461d5228a603326ef4903d53c4152dcd23f64e9fb80417632b7d0463a52b3650" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a1-cp27-cp27mu-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "98950e798ecd7fb4b7d8e0f93283d2cd", "packagetype": "bdist_wheel", "python_version": "cp27", "requires_python": null, "size": 788415, "upload_time": "2018-09-30T16:24:42", "url": "https://files.pythonhosted.org/packages/f9/26/a51261796572f21ab333395b914c9565e9a9a73a2348aa091cbe45d8dd25/pynvvl_cuda92-0.0.3a1-cp27-cp27mu-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "f11eade0f66e6c0d02db72e05fdfae10", "sha256": "906c8b4f7a36ddb6947c6f4d3adba2f4b6f1b23a635c4dc181fef1a32b2c723c" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a1-cp34-cp34m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "f11eade0f66e6c0d02db72e05fdfae10", "packagetype": "bdist_wheel", "python_version": "cp34", "requires_python": null, "size": 803110, "upload_time": "2018-09-30T16:24:45", "url": "https://files.pythonhosted.org/packages/1d/ca/676b8b6a8e4c2e4caadb98fa08f874634fea67b9c77906d5e1c0a1c65cae/pynvvl_cuda92-0.0.3a1-cp34-cp34m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "37b5eb037bed4c6b12cd252786c439d6", "sha256": "78498e4ad2c65da2ede60185ab7706bd5a44c7a999d31f732f64e037c77ab277" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a1-cp35-cp35m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "37b5eb037bed4c6b12cd252786c439d6", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 800279, "upload_time": "2018-09-30T16:24:47", "url": "https://files.pythonhosted.org/packages/ed/d3/e0f739c49d69685cbab8be00ffef2f374c03f62a85f0e8c619ad4a28fdba/pynvvl_cuda92-0.0.3a1-cp35-cp35m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "99b68a9c6202accf1bd86c3794d984c9", "sha256": "0c993ed0ce5f3d9c9b10601c74a2ea662302a81e4eac6c353184168694b613c5" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a1-cp36-cp36m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "99b68a9c6202accf1bd86c3794d984c9", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 804704, "upload_time": "2018-09-30T16:24:49", "url": "https://files.pythonhosted.org/packages/27/1f/b94706a922e91fa709ea97a02b380d569de3e76665a7987978faeaed9633/pynvvl_cuda92-0.0.3a1-cp36-cp36m-manylinux1_x86_64.whl" } ], "0.0.3a2": [ { "comment_text": "", "digests": { "md5": "719f5bb9726fbf5ef1636bd837960384", "sha256": "3ae9d8e6b357853f503966e4cff9eba53b8a3b0d8928cb7526f49ff8cbe3d53e" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp27-cp27mu-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "719f5bb9726fbf5ef1636bd837960384", "packagetype": "bdist_wheel", "python_version": "cp27", "requires_python": null, "size": 788426, "upload_time": "2018-09-30T17:11:11", "url": "https://files.pythonhosted.org/packages/96/cd/5955aeadb401779c129de7377bc30cc63be0e8f67b5426b458cda558e3ac/pynvvl_cuda92-0.0.3a2-cp27-cp27mu-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "9468f4d236016d05a54d5946f5491312", "sha256": "3c7be7cc0aca18429d285bb22f3529325c339437a6513ffd790f2fb9ef2ca402" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp34-cp34m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "9468f4d236016d05a54d5946f5491312", "packagetype": "bdist_wheel", "python_version": "cp34", "requires_python": null, "size": 803122, "upload_time": "2018-09-30T17:11:13", "url": "https://files.pythonhosted.org/packages/0f/cd/f66de5cb71aad77142c5e4572d010e8af0d0667db8444bc71456a9ca6d8a/pynvvl_cuda92-0.0.3a2-cp34-cp34m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "cc928f129996542fc16b5030b6397a83", "sha256": "f84347ac2577b9f710a09ff2178255f7389fb4847211fe572a286df4b0e2e501" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp35-cp35m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "cc928f129996542fc16b5030b6397a83", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 800292, "upload_time": "2018-09-30T17:11:15", "url": "https://files.pythonhosted.org/packages/b3/20/0135ac884721ac7bc6528d0958e38702f1fa2540d9f7f1b158ce173d821a/pynvvl_cuda92-0.0.3a2-cp35-cp35m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "a35aa9bcab53cb0d96569fb332774234", "sha256": "7fade5d37dac0fd2da179b3c2bf3aa6ca5eb430fe512f6d1fb09e06273358b79" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp36-cp36m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "a35aa9bcab53cb0d96569fb332774234", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 804715, "upload_time": "2018-09-30T17:11:18", "url": "https://files.pythonhosted.org/packages/93/bd/6b683cc0c1e7102bbcca771fd66097f643510cb91e7f3c2e783598133dc9/pynvvl_cuda92-0.0.3a2-cp36-cp36m-manylinux1_x86_64.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "719f5bb9726fbf5ef1636bd837960384", "sha256": "3ae9d8e6b357853f503966e4cff9eba53b8a3b0d8928cb7526f49ff8cbe3d53e" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp27-cp27mu-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "719f5bb9726fbf5ef1636bd837960384", "packagetype": "bdist_wheel", "python_version": "cp27", "requires_python": null, "size": 788426, "upload_time": "2018-09-30T17:11:11", "url": "https://files.pythonhosted.org/packages/96/cd/5955aeadb401779c129de7377bc30cc63be0e8f67b5426b458cda558e3ac/pynvvl_cuda92-0.0.3a2-cp27-cp27mu-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "9468f4d236016d05a54d5946f5491312", "sha256": "3c7be7cc0aca18429d285bb22f3529325c339437a6513ffd790f2fb9ef2ca402" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp34-cp34m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "9468f4d236016d05a54d5946f5491312", "packagetype": "bdist_wheel", "python_version": "cp34", "requires_python": null, "size": 803122, "upload_time": "2018-09-30T17:11:13", "url": "https://files.pythonhosted.org/packages/0f/cd/f66de5cb71aad77142c5e4572d010e8af0d0667db8444bc71456a9ca6d8a/pynvvl_cuda92-0.0.3a2-cp34-cp34m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "cc928f129996542fc16b5030b6397a83", "sha256": "f84347ac2577b9f710a09ff2178255f7389fb4847211fe572a286df4b0e2e501" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp35-cp35m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "cc928f129996542fc16b5030b6397a83", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": null, "size": 800292, "upload_time": "2018-09-30T17:11:15", "url": "https://files.pythonhosted.org/packages/b3/20/0135ac884721ac7bc6528d0958e38702f1fa2540d9f7f1b158ce173d821a/pynvvl_cuda92-0.0.3a2-cp35-cp35m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "a35aa9bcab53cb0d96569fb332774234", "sha256": "7fade5d37dac0fd2da179b3c2bf3aa6ca5eb430fe512f6d1fb09e06273358b79" }, "downloads": -1, "filename": "pynvvl_cuda92-0.0.3a2-cp36-cp36m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "a35aa9bcab53cb0d96569fb332774234", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 804715, "upload_time": "2018-09-30T17:11:18", "url": "https://files.pythonhosted.org/packages/93/bd/6b683cc0c1e7102bbcca771fd66097f643510cb91e7f3c2e783598133dc9/pynvvl_cuda92-0.0.3a2-cp36-cp36m-manylinux1_x86_64.whl" } ] }