diff --git a/README.md b/README.md index c73f07c..5cf6c9a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Image Decode Implementation with NVJpeg and CV2 +# Image Decode Implementation with CV2 and nvjpeg -*author: Junjie Jiang* +*author: junjie.jiang* @@ -10,10 +10,10 @@ ## Description -An image decode operator implementation with OpenCV and NvJpeg. -The decoder will use GPU to decode jpeg images. +An image decode operator implementation with OpenCV and nvjpeg. +In CPU env, use OpenCV, in GPU env, use nvjpeg to decode jpeg files. + -Only supports linux.
@@ -21,32 +21,24 @@ Only supports linux. ## Code Example -Load a image from path './dog.jpg'. +Load a image from path './src_dog.jpg'. *Write the pipeline in simplified style:* ```python -import towhee - -towhee.glob('./dog.jpg') \ - .image_decode.nvjpeg() \ - .show() -``` +from towhee.dc2 import pipe, ops, DataCollection -*Write a same pipeline with explicit inputs/outputs name specifications:* -```python -import towhee +p = ( + pipe.input('url') + .map('url', 'image', ops.image_decode.nvjpeg()) + .output('image') +) -towhee.glob['path']('./dog.jpg') \ - .image_decode.nvjpeg['path', 'img']() \ - .select['img']() \ - .show() +DataCollection(p('./src_dog.jpg')).show() ``` - - - + @@ -58,7 +50,7 @@ towhee.glob['path']('./dog.jpg') \ Create the operator via the following factory method: -***image_decode.nvjpeg()*** +***ops.image_decode.nvjpeg()*** @@ -76,7 +68,7 @@ An image decode operator takes an image path as input. It decodes the image back **img**: *str* -​ Image file path. +​ Local file path or http url. diff --git a/dog.jpg b/dog.jpg new file mode 100644 index 0000000..02a8b9f Binary files /dev/null and b/dog.jpg differ diff --git a/src_dog.jpg b/src_dog.jpg new file mode 100644 index 0000000..02a8b9f Binary files /dev/null and b/src_dog.jpg differ