diff --git a/README.md b/README.md index 6f8106c..7d09ea7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
-## Desription +## Description An image embedding operator generates a vector given an image. This operator extracts features for image top ranked models from @@ -18,22 +18,25 @@ The default pretrained model weights are from [The 1st Place Solution of ISC21 ( Load an image from path './towhee.jpg' and use the pretrained ISC model ('resnet50') to generate an image embedding. - *Write the pipeline in simplified style:* +*Write a same pipeline with explicit inputs/outputs name specifications:* + +- **option 1:** ```python -import towhee +from towhee.dc2 import pipe, ops, DataCollection -( - towhee.glob('./towhee.jpg') - .image_decode() - .image_embedding.isc() - .show() +p = ( + pipe.input('path') + .map('path', 'img', ops.image_decode()) + .map('img', 'vec', ops.image_embedding.isc()) + .output('img', 'vec') ) -``` - -*Write a same pipeline with explicit inputs/outputs name specifications:* +DataCollection(p('towhee.jpeg')).show() +``` + +- **option 2:** ```python import towhee @@ -45,7 +48,6 @@ import towhee .show() ) ``` -
@@ -83,10 +85,32 @@ It uses the pre-trained model specified by model name to generate an image embed The decoded image data in numpy.ndarray. - **Returns:** *numpy.ndarray* The image embedding extracted by model. +
+ +***save_model(format='pytorch', path='default')*** + +Save model to local with specified format. + +**Parameters:** + +***format***: *str* + +​ The format of saved model, defaults to 'pytorch'. + +***path***: *str* + +​ The path where model is saved to. By default, it will save model to the operator directory. + +```python +from towhee import ops + +op = ops.image_embedding.isc().get_op() +op.save_model('onnx', 'test.onnx') +``` + diff --git a/result2.png b/result.png similarity index 100% rename from result2.png rename to result.png diff --git a/result1.png b/result1.png deleted file mode 100644 index 1e02649..0000000 Binary files a/result1.png and /dev/null differ