deepvision-sdk


Namedeepvision-sdk JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryDeepVision Python SDK makes face recognition into your application even easier.
upload_time2023-12-21 01:44:13
maintainer
docs_urlNone
authorNguyen Quang Duy
requires_python
license
keywords deepvision computer vision sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DeepVision Python SDK

DeepVision Python SDK makes product recognition into your application even easier.

# Table of content
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
  - [Initialization](#initialization)
  - [Adding products into a product collection](#adding-products-into-a-product-collection)
  - [Recognition](#recognition)
- [Reference](#reference)
  - [DeepVision Global Object](#deepvision-global-object)
    - [Methods](#methods)
  - [Product Recognition Service](#product-recognition-service)
    - [Recognize Products from a Given Image](#recognize-products-from-a-given-image)
    - [Get Product Collection](#get-product-collection)
      - [Add an Example of a Product](#add-an-example-of-a-product)
      - [List of All Saved Examples of the Product](#list-of-all-saved-examples-of-the-product)
      - [Delete All Examples of the Product by Name](#delete-all-examples-of-the-product-by-name)
      - [Delete an Example of the Product by ID](#delete-an-example-of-the-product-by-id)
      - [Verify Products from a Given Image](#verify-products-from-a-given-image)
    - [Get Products](#get-products)
      - [Add a Product](#add-a-product)
      - [List Products](#list-products)
      - [Rename a Product](#rename-a-product)
      - [Delete a Product](#delete-a-product)
      - [Delete All Products](#delete-all-products)
    - [Product Detection Service](#product-detection-service)
      - [Detect](#detect)
    - [Product Verification Service](#product-verification-service)
      - [Verify](#verify)

# Requirements

Before using our SDK make sure you have installed Python on your machine.
1. [Python](https://www.python.org/downloads/) (Version 3.7+)

## DeepVision compatibility matrix
Explanation:

* ✔  SDK supports all functionality from DeepVision. 


# Installation

It can be installed through pip:

```shell
pip install deepvision-sdk
```

# Usage

All these examples you can find in repository inside [examples](/examples) folder.

## Initialization

To start using Python SDK you need to import `DeepVision` object from 'deepvision-sdk' dependency.  

After you initialized `DeepVision` object you need to init the service object with the `api key` of your product service. You can use this service object to recognize products.

However, before recognizing you need first to add products into the product collection. To do this, get the product collection object from the service object.

```python
from deepvision import DeepVision
from deepvision.service import ProductRecognitionService
from deepvision.collections import ProductCollection
from deepvision.collections.product_collections import Products

DOMAIN: str = 'http://deepvision.ekgis.vn'
PORT: str = '2023'
API_KEY: str = 'your_api_key'

deep_vision: DeepVision = DeepVision(DOMAIN, PORT)

product_recognition: ProductRecognitionService = deep_vision.init_product_recognition(API_KEY)

product_collection: ProductCollection = product_recognition.get_product_collection()

products: Products = product_recognition.get_products()
```

## Adding products into a product collection

Here is example that shows how to add an image to your product collection from your file system:

```python
collection_name= 'example_collection'
product_id = 'c303282d-f2e6-46ca-a04a-35d3d873712d'
product_name = 'example'
image_path = ['./common/product_example.png']
image_id = ['bd65600d-8669-4903-8a14-af88203add38']

product_collection.add(collection_name=collection_name, product_id=product_id, product_name=product_name, image_path=image_path, image_id=image_id)
```

## Recognition

This code snippet shows how to recognize unknown product.

```python
collection_name: str = 'example_collection'
image_path = './common/product_example.png'

product_recognition.recognize(collection_name = collection_name, image_path=image_path)
```

# Reference

## DeepVision Global Object

Global DeepVision Object is used for initializing connection to DeepVision and setting default values.
Default values will be used in every service method if applicable.
If the option’s value is set in the global object and passed as a function argument then the function argument value will be used.

**Constructor:**

```DeepVision(domain, port)```

| Argument | Type   | Required | Notes                                     | 
| ---------| ------ | -------- | ----------------------------------------- | 
| url      | string | required | URL with protocol where DeepVision is located. E.g. `http://deepvision.ekgis.vn` |
| port     | string | required | DeepVision port. E.g. `2023` |

Example:

```python
from deepvision import DeepVision

DOMAIN: str = 'http://deepvision.ekgis.vn'
PORT: str = '2023'

deep_vision: DeepVision = DeepVision(domain=DOMAIN, port=PORT})
```

### Methods

1. ```DeepVision.init_product_recognition(api_key)```

Inits product recognition service object.

| Argument | Type   | Required | Notes                                     |
| ---------| ------ | -------- | ----------------------------------------- |
| api_key  | string | required | Product Recognition Api Key in UUID format    |

Example:

```python
from deepvision.service import ProductRecognitionService

PRODUCT_RECOGNITION_API_KEY: str = 'your_api_key'

product_recognition: ProductRecognitionService = deep_vision.init_product_recognition(PRODUCT_RECOGNITION_API_KEY)
```

2. ```DeepVision.init_product_detection(api_key)```

Inits product detection service object.

| Argument | Type   | Required | Notes                                     |
| ---------| ------ | -------- | ----------------------------------------- |
| api_key  | string | required | Product Detection Api Key in UUID format    |

Example:

```python
from deepvision.service import ProductDetectionService

PRODUCT_DETECTION_API_KEY: str = 'your_product_detection_key'

product_detection: ProductDetectionService = deep_vision.init_product_detection(PRODUCT_DETECTION_API_KEY)
```

3. ```DeepVision.init_product_verification(api_key)```

Inits product verification service object.

| Argument | Type   | Required | Notes                                     |
| ---------| ------ | -------- | ----------------------------------------- |
| api_key  | string | required | Product Verification Api Key in UUID format    |

Example:

```python
from deepvision.service import ProductVerificationService

PRODUCT_VERIFICATION_API_KEY: str = 'your_api_key'

product_verify: ProductVerificationService = deep_vision.init_product_verification(PRODUCT_VERIFICATION_API_KEY)
```

Example of product recognition with object:

```python
product_recognition.recognize(collection_name=collection_name, image_path=image_path)
```

## Product Recognition Service

Product recognition service is used for product identification.
This means that you first need to upload known products to product collection and then recognize unknown products among them.
When you upload an unknown product, the service returns the most similar products to it.
Also, product recognition service supports verify endpoint to check if this person from product collection is the correct one.

### Recognize Products from a Given Image

*[Example](examples/recognize_product_from_image.py)*

Recognizes all products from the image.
The first argument is the image location, it can be an url, local path or bytes.

```python
product_recognition.recognize(collection_name=collection_name, image_path=image_path)
```

| Argument           | Type    | Required | Notes                                                                                                                                          |
| ------------------ | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| collection_name    | collection_name  | required | Collection contains sample products.  |
| image_path         | image   | required | Image can pass from url, local path or bytes. Max size is 5Mb                                                         |

Response:

```json
{
    'status': 'completed',
    'result': {
        'embedding': [-0.03902999835598629, "...", -0.028654199455642616],
        'bbox': [
            0, 0, 624, 773],
        'products': {
            'similarity': 0.9999999999999998,
            'product': 'test'
        }
    }
}
```

| Element                    | Type    | Description                                                                                                                                                 |
| -------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| status                     | string   | status of the recognize operation.                                                   |
| embedding                  | array   | product embeddings.                                                   |
| bbox                        | array  | list of parameters of the bounding box for this product                                                                                                        |
| products                   | list    | list of similar products with size of <prediction_count> order by similarity                                                                                |
| similarity                 | float   | similarity that on that image predicted person                                                                                                              |
| product                    | string  | name of the product in Product Collection                                                                                                                      |

### Get Product Collection

```python
product_recognition.get_product_collection()
```

Returns Product collection object

Product collection could be used to manage known products, e.g. add, list, or delete them.

Product recognition is performed for the saved known products in product collection, so before using the `recognize` method you need to save at least one product into the product collection.

**Methods:**

#### Add an Example of a Product

*[Example](examples/add_example_of_a_product.py)*

This creates an example of the product by saving images. You can add as many images as you want to train the system. Image should
contain only one product.

```python
product_collection.add(collection_name, image_id, image_path, product_id, product_name)
```

| Argument           | Type   | Required | Notes                                                                                                |
| ------------------ | ------ | -------- | ---------------------------------------------------------------------------------------------------- |
| collection_name    | collection_name  | required | Collection contains sample products.  |
| image_id         | UUID  | required |  UUID of uploaded image               |
| image_path         | image  | required | Image can pass from url, local path or bytes. Max size is 5Mb               |
| product_id            | string | required | UUID of the saved product                                                         |
| product_name          | string | required | is the name you assign to the product you save                                                         |

Response:

```json
{
    'status': 'completed',
    'result':
    {
        'product_id': 'c303282d-f2e6-46ca-a04a-35d3d873712d',
        'product_name': 'example',
        'image_id': 'bd65600d-8669-4903-8a14-af88203add38'
    }
}
```

| Element  | Type   | Description                |
| -------- | ------ | -------------------------- |
| status   | string | status of the add operationt.  |
| product_id  | UUID | UUID of the saved product |
| product_name  | string | Name of the saved product |
| image_id | UUID   | UUID of uploaded image     |

#### List of All Saved Examples of the Product

To retrieve a list of products saved in a Product Collection:

```python
product_collection.list()
```

| Argument           | Type   | Required | Notes                                                                                                |
| ------------------ | ------ | -------- | ---------------------------------------------------------------------------------------------------- |
| collection_name    | collection_name  | required | Collection contains sample products.  |

Response:

```
{
    'status': 'completed',
    'result': [
        {
            'image_id': '938352ea-d744-4752-9ee8-0c73e9f55942',
            'product_id': '4371bb18-2a36-428b-92c2-da2e974168af',
            'product_name': 'example'
        },
        ...
    ]
}
```

| Element  | Type   | Description                |
| -------- | ------ | -------------------------- |
| status   | string | status of the list operation.  |
| product_id  | UUID | UUID of the saved product |
| product_name  | string | <product> of the product, whose picture was saved for this api key |
| image_id | UUID   | UUID of uploaded image     |



#### Delete All Examples of the Product by Name

*[Example](examples/delete_all_examples_of_product.py)*

To delete all image examples of the <product>:

```python
product_collection.delete_all(collection_name, product_name)
```

| Argument  | Type   | Required | Notes                                                                                                                                |
| --------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| collection_name    | collection_name  | required | Collection contains sample products.  |
| product_name   | string | optional | is the name you assign to the image you save. |

Response:

```
{
    'status': 'completed',
    'result':
    {
        'deleted': <count>
    }
}
```

| Element  | Type    | Description              |
| -------- | ------- | ------------------------ |
| status   | string | status of the delete operation .  |
| deleted  | integer | Number of deleted examples  |

#### Delete an Example of the Product by ID

*[Example](examples/delete_example_by_id.py)*

To delete an image by ID:

```python
product_collection.delete(collection_name, image_id)
```
| Argument  | Type   | Required | Notes                                                        |
| --------- | ------ | -------- | ------------------------------------------------------------ 
| collection_name    | collection_name  | required | Collection contains sample products.  |
| image_id  | UUID   | required | UUID of the removing product                                    |

Response:

```
{
    'status': 'completed',
    'result':
    {
        'image_id': <removed_image_id>
    }
}
```

| Element  | Type   | Description                                                       |
| -------- | ------ | ----------------------------------------------------------------- |
| status   | string | status of the delete operation.  |
| image_id | UUID   | UUID of the removed product                                          |

#### Verify Products from a Given Image

*[Example](examples/verification_product_from_image.py)*

```python
product_collection.verify(collection_name, image_path, product_name)
```

Compares similarities of given image with image from your product collection.


| Argument           | Type    | Required | Notes                                                                                                                                                 |
| ------------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| collection_name    | collection_name  | required | Collection contains sample products.  |
| image_path         | image   | required | Image can pass from url, local path or bytes. Max size is 5Mb                                                                |
| product_id           | UUID    | required | UUID of the verifying product                                                                                                                            |

Response:

```json
{
    'status': 'completed',
    'result':
    {
        'verify': 'True',
        'product': 'test',
        'embedding': [-0.03902999835598629, "...", -0.028654199455642616],
        'bbox': [0, 0, 624, 773]
    }
}
```

| Element                        | Type    | Description                                                  |
| ------------------------------ | ------- | ------------------------------------------------------------ |
| status   | string | status of the verify operation. |
| verify   | Boolean | result of the verify operation. |
| embedding                      | array   | product embeddings.      |
| bbox                            | object  | list of parameters of the bounding box for this product         |

### Get Products

```python
product_recognition.get_products()
```

Returns products object

Products object allows working with products directly (not via product examples).

More information about products [here](https://bugs.ekgis.vn/deepvision)

**Methods:**

#### Add a Product

*[Example](examples/add_product.py)*

Create a new product in Product Collection.
```python
products.add(collection_name, product_id, product_name, image_paths, image_ids)
```

| Argument           | Type   | Required | Notes                                                                   |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------|
| collection_name    | collection_name  | required | Collection contains sample products.  |
| image_ids        | UUID  | required |  List UUID of uploaded image               |
| image_paths         | image  | required | List image can pass from url, local path or bytes.              |
| product_id            | string | required | UUID of the saved product                                                         |
| product_name          | string | required | is the name you assign to the product you save                                               |

Response:

```json
{
    "status": 'completed',
    'result':
    {
        "image_id": <image_ids>,
        "product_id": <product_id>,
        "product_name": <product_name>
    }
}
```

| Element  | Type   | Description                |
| -------- | ------ | -------------------------- |
| status   | string | status of the add operationt.  |
| product_id  | UUID | UUID of the saved product |
| product_name  | string | Name of the saved product |
| image_id | UUID   | UUID of uploaded image     |

#### List Products

*[Example](examples/get_list_of_all_products.py)*

Returns all product related to Product Collection.
```python
products.list(collection_name=collection_name)
```

Response:

```json
{
    'status': 'completed',
    'result':
    [
        {'product_id': '123', 'product_name': 'test'},
        ...
    ]
}

```

| Element  | Type   | Description                |
| -------- | ------ | -------------------------- |
| status   | string | status of the list operationt.  |
| product_id  | UUID | UUID of the saved product |
| product_name  | string | Name of the saved product |

#### Rename a Product

*[Example](examples/update_existing_product.py)*

Rename existing product. If a new product name already exists, products are merged - all products from the old product name are reassigned to the product with the new name, old product removed.

```python
products.rename(collection_name, product_id, new_name)
```

| Argument            | Type   | Required | Notes                                                                   |
| ------------------  | ------ | -------- | ------------------------------------------------------------------------|
| collection_name    | collection_name  | required | Collection contains sample products.  |
| product_id             | string | required | is the UUID of the product that will be updated                         |
| new_name            | string | required | is the name of the product. It can be any string                        |

Response:

```json
{
    'status': 'completed',
    'result':
    {
        "updated": "true|false"
    }
}
```

| Element  | Type    | Description                |
| -------- | ------  | -------------------------- |
| status   | string | status of the update operationt.  |
| updated  | boolean | failed or success          |

#### Delete a Product

*[Example](examples/delete_product_by_id.py)*

Delete existing product and all saved products by id.
```python
products.delete_product_by_id(collection_name, product_id)
```

| Argument           | Type   | Required | Notes                                                                   |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------|
| collection_name    | collection_name  | required | Collection contains sample products.  |
| product_id            | string | required | is the name of the product.                                             |

Response:

```json
{
    'status': 'completed',
    'result':
    {
        'product_id': <remove_id>
    }
}
```

| Element  | Type   | Description                |
| -------- | ------ | -------------------------- |
| status   | string | status of the remove operationt.  |
| product_id  | string | is the id of removed product |


*[Example](examples/delete_product_by_name.py)*

Delete existing product and all saved products by name.
```python
products.delete_product_by_name(collection_name, product_name)
```

| Argument           | Type   | Required | Notes                                                                   |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------|
| collection_name    | collection_name  | required | Collection contains sample products.  |
| product_name            | string | required | is the name of the product.                                             |

Response:

```json
{
    'status': 'completed',
    'result':
    {
        'product_name': <remove_name>
    }
}
```

| Element  | Type   | Description                |
| -------- | ------ | -------------------------- |
| status   | string | status of the remove operationt.  |
| product  | string | is the name of the product |

#### Delete All Products

*[Example](examples/delete_all_products.py)*

Delete all existing products and all saved products.
```python
products.delete_all(collection_name)
```

| Argument           | Type   | Required | Notes                                                                   |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------|
| collection_name    | collection_name  | required | Collection contains sample products.  |

Response:

```json
{
    'status': 'completed',
    'result':
    {
        'deleted': <count>
    }
}
```

| Element  | Type    | Description              |
| -------- | ------- | ------------------------ |
| status   | string | status of the delete operation .  |
| deleted  | integer | Number of deleted products  |


## Product Detection Service

Product detection service is used for detecting products in the image.

**Methods:**

### Detect

*[Example](examples/detect_product_from_image.py)*

```python
product_detection.detect(image_path)
```

Finds all products on the image.

| Argument          | Type    | Required | Notes                                                                                                                                          |
| ----------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| image_path        | image   | required | image where to detect products. Image can pass from url, local path or bytes. Max size is 5Mb                            |


Response:

```json
{
    'status': '1',
    'locates':
    [
        {'label': 'product', 'score': 0.959, 'bbox': [193, 160, 379, 363]},
        "...",
        {'label': 'product', 'score': 0.563, 'bbox': [233, 754, 323, 772]}
    ]
}}
```

| Element                        | Type    | Description                                                  |
| ------------------------------ | ------- | ------------------------------------------------------------ |
| status   | string | status of the delete operation .  |
| bbox                            | array  | list of parameters of the bounding box for this product (on processedImage) |
| label                    | string   | Label detection     |


## Product Verification Service

*[Example](examples/verify_product_from_image.py)*

Product verification service is used for comparing two images.
A source image should contain only one product which will be compared to all products on the target image.

**Methods:**

### Verify

```python
product_verify.verify(source_image_path, target_image_path)
```

Compares two images provided in arguments. Source image should contain only one product, it will be compared to all products in the target image.

| Argument            | Type    | Required | Notes                                                                                                                                                 |
| ------------------  | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| source_image_path   | image   | required | file to be verified. Image can pass from url, local path or bytes. Max size is 5Mb                                           |
| target_image_path   | image   | required | reference file to check the source file. Image can pass from url, local path or bytes. Max size is 5Mb                       |

Response:

```json
{
    'status': 'completed',
    'result': {
        'source_image_product':
        {
            'embedding': [-0.03902999835598629, '...', -0.028654199455642616],
            'bbox': [0, 0, 624, 773]
        },
            'product_matches':
            {
                'embedding': [-0.03902999835598629, '...', 5, -0.028654199455642616],
                'bbox': [0, 0, 624, 773],
                'verify': 'True',
                'similarity': array([[0.]])
        }
    }
}
```

| Element                        | Type    | Description                                                  |
| ------------------------------ | ------- | ------------------------------------------------------------ |
| source_image_product              | object  | additional info about source image product |
| product_matches                   | array   | result of product verification |
| embedding                      | array   | product embeddings.       |
| box                            | object  | list of parameters of the bounding box for this product         |
| verify  | boolean | failed or success          |
| similarity                     | float   | similarity between this product and the product on the source image               |


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "deepvision-sdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "DeepVision,Computer Vision,SDK",
    "author": "Nguyen Quang Duy",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/a9/e0/7d97bfc6f7f1095852952361c511f91c7c5299e556041fc40725bfab863d/deepvision-sdk-0.1.1.tar.gz",
    "platform": null,
    "description": "# DeepVision Python SDK\n\nDeepVision Python SDK makes product recognition into your application even easier.\n\n# Table of content\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Initialization](#initialization)\n  - [Adding products into a product collection](#adding-products-into-a-product-collection)\n  - [Recognition](#recognition)\n- [Reference](#reference)\n  - [DeepVision Global Object](#deepvision-global-object)\n    - [Methods](#methods)\n  - [Product Recognition Service](#product-recognition-service)\n    - [Recognize Products from a Given Image](#recognize-products-from-a-given-image)\n    - [Get Product Collection](#get-product-collection)\n      - [Add an Example of a Product](#add-an-example-of-a-product)\n      - [List of All Saved Examples of the Product](#list-of-all-saved-examples-of-the-product)\n      - [Delete All Examples of the Product by Name](#delete-all-examples-of-the-product-by-name)\n      - [Delete an Example of the Product by ID](#delete-an-example-of-the-product-by-id)\n      - [Verify Products from a Given Image](#verify-products-from-a-given-image)\n    - [Get Products](#get-products)\n      - [Add a Product](#add-a-product)\n      - [List Products](#list-products)\n      - [Rename a Product](#rename-a-product)\n      - [Delete a Product](#delete-a-product)\n      - [Delete All Products](#delete-all-products)\n    - [Product Detection Service](#product-detection-service)\n      - [Detect](#detect)\n    - [Product Verification Service](#product-verification-service)\n      - [Verify](#verify)\n\n# Requirements\n\nBefore using our SDK make sure you have installed Python on your machine.\n1. [Python](https://www.python.org/downloads/) (Version 3.7+)\n\n## DeepVision compatibility matrix\nExplanation:\n\n* \u2714  SDK supports all functionality from DeepVision. \n\n\n# Installation\n\nIt can be installed through pip:\n\n```shell\npip install deepvision-sdk\n```\n\n# Usage\n\nAll these examples you can find in repository inside [examples](/examples) folder.\n\n## Initialization\n\nTo start using Python SDK you need to import `DeepVision` object from 'deepvision-sdk' dependency.  \n\nAfter you initialized `DeepVision` object you need to init the service object with the `api key` of your product service. You can use this service object to recognize products.\n\nHowever, before recognizing you need first to add products into the product collection. To do this, get the product collection object from the service object.\n\n```python\nfrom deepvision import DeepVision\nfrom deepvision.service import ProductRecognitionService\nfrom deepvision.collections import ProductCollection\nfrom deepvision.collections.product_collections import Products\n\nDOMAIN: str = 'http://deepvision.ekgis.vn'\nPORT: str = '2023'\nAPI_KEY: str = 'your_api_key'\n\ndeep_vision: DeepVision = DeepVision(DOMAIN, PORT)\n\nproduct_recognition: ProductRecognitionService = deep_vision.init_product_recognition(API_KEY)\n\nproduct_collection: ProductCollection = product_recognition.get_product_collection()\n\nproducts: Products = product_recognition.get_products()\n```\n\n## Adding products into a product collection\n\nHere is example that shows how to add an image to your product collection from your file system:\n\n```python\ncollection_name= 'example_collection'\nproduct_id = 'c303282d-f2e6-46ca-a04a-35d3d873712d'\nproduct_name = 'example'\nimage_path = ['./common/product_example.png']\nimage_id = ['bd65600d-8669-4903-8a14-af88203add38']\n\nproduct_collection.add(collection_name=collection_name, product_id=product_id, product_name=product_name, image_path=image_path, image_id=image_id)\n```\n\n## Recognition\n\nThis code snippet shows how to recognize unknown product.\n\n```python\ncollection_name: str = 'example_collection'\nimage_path = './common/product_example.png'\n\nproduct_recognition.recognize(collection_name = collection_name, image_path=image_path)\n```\n\n# Reference\n\n## DeepVision Global Object\n\nGlobal DeepVision Object is used for initializing connection to DeepVision and setting default values.\nDefault values will be used in every service method if applicable.\nIf the option\u2019s value is set in the global object and passed as a function argument then the function argument value will be used.\n\n**Constructor:**\n\n```DeepVision(domain, port)```\n\n| Argument | Type   | Required | Notes                                     | \n| ---------| ------ | -------- | ----------------------------------------- | \n| url      | string | required | URL with protocol where DeepVision is located. E.g. `http://deepvision.ekgis.vn` |\n| port     | string | required | DeepVision port. E.g. `2023` |\n\nExample:\n\n```python\nfrom deepvision import DeepVision\n\nDOMAIN: str = 'http://deepvision.ekgis.vn'\nPORT: str = '2023'\n\ndeep_vision: DeepVision = DeepVision(domain=DOMAIN, port=PORT})\n```\n\n### Methods\n\n1. ```DeepVision.init_product_recognition(api_key)```\n\nInits product recognition service object.\n\n| Argument | Type   | Required | Notes                                     |\n| ---------| ------ | -------- | ----------------------------------------- |\n| api_key  | string | required | Product Recognition Api Key in UUID format    |\n\nExample:\n\n```python\nfrom deepvision.service import ProductRecognitionService\n\nPRODUCT_RECOGNITION_API_KEY: str = 'your_api_key'\n\nproduct_recognition: ProductRecognitionService = deep_vision.init_product_recognition(PRODUCT_RECOGNITION_API_KEY)\n```\n\n2. ```DeepVision.init_product_detection(api_key)```\n\nInits product detection service object.\n\n| Argument | Type   | Required | Notes                                     |\n| ---------| ------ | -------- | ----------------------------------------- |\n| api_key  | string | required | Product Detection Api Key in UUID format    |\n\nExample:\n\n```python\nfrom deepvision.service import ProductDetectionService\n\nPRODUCT_DETECTION_API_KEY: str = 'your_product_detection_key'\n\nproduct_detection: ProductDetectionService = deep_vision.init_product_detection(PRODUCT_DETECTION_API_KEY)\n```\n\n3. ```DeepVision.init_product_verification(api_key)```\n\nInits product verification service object.\n\n| Argument | Type   | Required | Notes                                     |\n| ---------| ------ | -------- | ----------------------------------------- |\n| api_key  | string | required | Product Verification Api Key in UUID format    |\n\nExample:\n\n```python\nfrom deepvision.service import ProductVerificationService\n\nPRODUCT_VERIFICATION_API_KEY: str = 'your_api_key'\n\nproduct_verify: ProductVerificationService = deep_vision.init_product_verification(PRODUCT_VERIFICATION_API_KEY)\n```\n\nExample of product recognition with object:\n\n```python\nproduct_recognition.recognize(collection_name=collection_name, image_path=image_path)\n```\n\n## Product Recognition Service\n\nProduct recognition service is used for product identification.\nThis means that you first need to upload known products to product collection and then recognize unknown products among them.\nWhen you upload an unknown product, the service returns the most similar products to it.\nAlso, product recognition service supports verify endpoint to check if this person from product collection is the correct one.\n\n### Recognize Products from a Given Image\n\n*[Example](examples/recognize_product_from_image.py)*\n\nRecognizes all products from the image.\nThe first argument is the image location, it can be an url, local path or bytes.\n\n```python\nproduct_recognition.recognize(collection_name=collection_name, image_path=image_path)\n```\n\n| Argument           | Type    | Required | Notes                                                                                                                                          |\n| ------------------ | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| image_path         | image   | required | Image can pass from url, local path or bytes. Max size is 5Mb                                                         |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result': {\n        'embedding': [-0.03902999835598629, \"...\", -0.028654199455642616],\n        'bbox': [\n            0, 0, 624, 773],\n        'products': {\n            'similarity': 0.9999999999999998,\n            'product': 'test'\n        }\n    }\n}\n```\n\n| Element                    | Type    | Description                                                                                                                                                 |\n| -------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| status                     | string   | status of the recognize operation.                                                   |\n| embedding                  | array   | product embeddings.                                                   |\n| bbox                        | array  | list of parameters of the bounding box for this product                                                                                                        |\n| products                   | list    | list of similar products with size of <prediction_count> order by similarity                                                                                |\n| similarity                 | float   | similarity that on that image predicted person                                                                                                              |\n| product                    | string  | name of the product in Product Collection                                                                                                                      |\n\n### Get Product Collection\n\n```python\nproduct_recognition.get_product_collection()\n```\n\nReturns Product collection object\n\nProduct collection could be used to manage known products, e.g. add, list, or delete them.\n\nProduct recognition is performed for the saved known products in product collection, so before using the `recognize` method you need to save at least one product into the product collection.\n\n**Methods:**\n\n#### Add an Example of a Product\n\n*[Example](examples/add_example_of_a_product.py)*\n\nThis creates an example of the product by saving images. You can add as many images as you want to train the system. Image should\ncontain only one product.\n\n```python\nproduct_collection.add(collection_name, image_id, image_path, product_id, product_name)\n```\n\n| Argument           | Type   | Required | Notes                                                                                                |\n| ------------------ | ------ | -------- | ---------------------------------------------------------------------------------------------------- |\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| image_id         | UUID  | required |  UUID of uploaded image               |\n| image_path         | image  | required | Image can pass from url, local path or bytes. Max size is 5Mb               |\n| product_id            | string | required | UUID of the saved product                                                         |\n| product_name          | string | required | is the name you assign to the product you save                                                         |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result':\n    {\n        'product_id': 'c303282d-f2e6-46ca-a04a-35d3d873712d',\n        'product_name': 'example',\n        'image_id': 'bd65600d-8669-4903-8a14-af88203add38'\n    }\n}\n```\n\n| Element  | Type   | Description                |\n| -------- | ------ | -------------------------- |\n| status   | string | status of the add operationt.  |\n| product_id  | UUID | UUID of the saved product |\n| product_name  | string | Name of the saved product |\n| image_id | UUID   | UUID of uploaded image     |\n\n#### List of All Saved Examples of the Product\n\nTo retrieve a list of products saved in a Product Collection:\n\n```python\nproduct_collection.list()\n```\n\n| Argument           | Type   | Required | Notes                                                                                                |\n| ------------------ | ------ | -------- | ---------------------------------------------------------------------------------------------------- |\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n\nResponse:\n\n```\n{\n    'status': 'completed',\n    'result': [\n        {\n            'image_id': '938352ea-d744-4752-9ee8-0c73e9f55942',\n            'product_id': '4371bb18-2a36-428b-92c2-da2e974168af',\n            'product_name': 'example'\n        },\n        ...\n    ]\n}\n```\n\n| Element  | Type   | Description                |\n| -------- | ------ | -------------------------- |\n| status   | string | status of the list operation.  |\n| product_id  | UUID | UUID of the saved product |\n| product_name  | string | <product> of the product, whose picture was saved for this api key |\n| image_id | UUID   | UUID of uploaded image     |\n\n\n\n#### Delete All Examples of the Product by Name\n\n*[Example](examples/delete_all_examples_of_product.py)*\n\nTo delete all image examples of the <product>:\n\n```python\nproduct_collection.delete_all(collection_name, product_name)\n```\n\n| Argument  | Type   | Required | Notes                                                                                                                                |\n| --------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| product_name   | string | optional | is the name you assign to the image you save. |\n\nResponse:\n\n```\n{\n    'status': 'completed',\n    'result':\n    {\n        'deleted': <count>\n    }\n}\n```\n\n| Element  | Type    | Description              |\n| -------- | ------- | ------------------------ |\n| status   | string | status of the delete operation .  |\n| deleted  | integer | Number of deleted examples  |\n\n#### Delete an Example of the Product by ID\n\n*[Example](examples/delete_example_by_id.py)*\n\nTo delete an image by ID:\n\n```python\nproduct_collection.delete(collection_name, image_id)\n```\n| Argument  | Type   | Required | Notes                                                        |\n| --------- | ------ | -------- | ------------------------------------------------------------ \n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| image_id  | UUID   | required | UUID of the removing product                                    |\n\nResponse:\n\n```\n{\n    'status': 'completed',\n    'result':\n    {\n        'image_id': <removed_image_id>\n    }\n}\n```\n\n| Element  | Type   | Description                                                       |\n| -------- | ------ | ----------------------------------------------------------------- |\n| status   | string | status of the delete operation.  |\n| image_id | UUID   | UUID of the removed product                                          |\n\n#### Verify Products from a Given Image\n\n*[Example](examples/verification_product_from_image.py)*\n\n```python\nproduct_collection.verify(collection_name, image_path, product_name)\n```\n\nCompares similarities of given image with image from your product collection.\n\n\n| Argument           | Type    | Required | Notes                                                                                                                                                 |\n| ------------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| image_path         | image   | required | Image can pass from url, local path or bytes. Max size is 5Mb                                                                |\n| product_id           | UUID    | required | UUID of the verifying product                                                                                                                            |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result':\n    {\n        'verify': 'True',\n        'product': 'test',\n        'embedding': [-0.03902999835598629, \"...\", -0.028654199455642616],\n        'bbox': [0, 0, 624, 773]\n    }\n}\n```\n\n| Element                        | Type    | Description                                                  |\n| ------------------------------ | ------- | ------------------------------------------------------------ |\n| status   | string | status of the verify operation. |\n| verify   | Boolean | result of the verify operation. |\n| embedding                      | array   | product embeddings.      |\n| bbox                            | object  | list of parameters of the bounding box for this product         |\n\n### Get Products\n\n```python\nproduct_recognition.get_products()\n```\n\nReturns products object\n\nProducts object allows working with products directly (not via product examples).\n\nMore information about products [here](https://bugs.ekgis.vn/deepvision)\n\n**Methods:**\n\n#### Add a Product\n\n*[Example](examples/add_product.py)*\n\nCreate a new product in Product Collection.\n```python\nproducts.add(collection_name, product_id, product_name, image_paths, image_ids)\n```\n\n| Argument           | Type   | Required | Notes                                                                   |\n| ------------------ | ------ | -------- | ------------------------------------------------------------------------|\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| image_ids        | UUID  | required |  List UUID of uploaded image               |\n| image_paths         | image  | required | List image can pass from url, local path or bytes.              |\n| product_id            | string | required | UUID of the saved product                                                         |\n| product_name          | string | required | is the name you assign to the product you save                                               |\n\nResponse:\n\n```json\n{\n    \"status\": 'completed',\n    'result':\n    {\n        \"image_id\": <image_ids>,\n        \"product_id\": <product_id>,\n        \"product_name\": <product_name>\n    }\n}\n```\n\n| Element  | Type   | Description                |\n| -------- | ------ | -------------------------- |\n| status   | string | status of the add operationt.  |\n| product_id  | UUID | UUID of the saved product |\n| product_name  | string | Name of the saved product |\n| image_id | UUID   | UUID of uploaded image     |\n\n#### List Products\n\n*[Example](examples/get_list_of_all_products.py)*\n\nReturns all product related to Product Collection.\n```python\nproducts.list(collection_name=collection_name)\n```\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result':\n    [\n        {'product_id': '123', 'product_name': 'test'},\n        ...\n    ]\n}\n\n```\n\n| Element  | Type   | Description                |\n| -------- | ------ | -------------------------- |\n| status   | string | status of the list operationt.  |\n| product_id  | UUID | UUID of the saved product |\n| product_name  | string | Name of the saved product |\n\n#### Rename a Product\n\n*[Example](examples/update_existing_product.py)*\n\nRename existing product. If a new product name already exists, products are merged - all products from the old product name are reassigned to the product with the new name, old product removed.\n\n```python\nproducts.rename(collection_name, product_id, new_name)\n```\n\n| Argument            | Type   | Required | Notes                                                                   |\n| ------------------  | ------ | -------- | ------------------------------------------------------------------------|\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| product_id             | string | required | is the UUID of the product that will be updated                         |\n| new_name            | string | required | is the name of the product. It can be any string                        |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result':\n    {\n        \"updated\": \"true|false\"\n    }\n}\n```\n\n| Element  | Type    | Description                |\n| -------- | ------  | -------------------------- |\n| status   | string | status of the update operationt.  |\n| updated  | boolean | failed or success          |\n\n#### Delete a Product\n\n*[Example](examples/delete_product_by_id.py)*\n\nDelete existing product and all saved products by id.\n```python\nproducts.delete_product_by_id(collection_name, product_id)\n```\n\n| Argument           | Type   | Required | Notes                                                                   |\n| ------------------ | ------ | -------- | ------------------------------------------------------------------------|\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| product_id            | string | required | is the name of the product.                                             |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result':\n    {\n        'product_id': <remove_id>\n    }\n}\n```\n\n| Element  | Type   | Description                |\n| -------- | ------ | -------------------------- |\n| status   | string | status of the remove operationt.  |\n| product_id  | string | is the id of removed product |\n\n\n*[Example](examples/delete_product_by_name.py)*\n\nDelete existing product and all saved products by name.\n```python\nproducts.delete_product_by_name(collection_name, product_name)\n```\n\n| Argument           | Type   | Required | Notes                                                                   |\n| ------------------ | ------ | -------- | ------------------------------------------------------------------------|\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n| product_name            | string | required | is the name of the product.                                             |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result':\n    {\n        'product_name': <remove_name>\n    }\n}\n```\n\n| Element  | Type   | Description                |\n| -------- | ------ | -------------------------- |\n| status   | string | status of the remove operationt.  |\n| product  | string | is the name of the product |\n\n#### Delete All Products\n\n*[Example](examples/delete_all_products.py)*\n\nDelete all existing products and all saved products.\n```python\nproducts.delete_all(collection_name)\n```\n\n| Argument           | Type   | Required | Notes                                                                   |\n| ------------------ | ------ | -------- | ------------------------------------------------------------------------|\n| collection_name    | collection_name  | required | Collection contains sample products.  |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result':\n    {\n        'deleted': <count>\n    }\n}\n```\n\n| Element  | Type    | Description              |\n| -------- | ------- | ------------------------ |\n| status   | string | status of the delete operation .  |\n| deleted  | integer | Number of deleted products  |\n\n\n## Product Detection Service\n\nProduct detection service is used for detecting products in the image.\n\n**Methods:**\n\n### Detect\n\n*[Example](examples/detect_product_from_image.py)*\n\n```python\nproduct_detection.detect(image_path)\n```\n\nFinds all products on the image.\n\n| Argument          | Type    | Required | Notes                                                                                                                                          |\n| ----------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| image_path        | image   | required | image where to detect products. Image can pass from url, local path or bytes. Max size is 5Mb                            |\n\n\nResponse:\n\n```json\n{\n    'status': '1',\n    'locates':\n    [\n        {'label': 'product', 'score': 0.959, 'bbox': [193, 160, 379, 363]},\n        \"...\",\n        {'label': 'product', 'score': 0.563, 'bbox': [233, 754, 323, 772]}\n    ]\n}}\n```\n\n| Element                        | Type    | Description                                                  |\n| ------------------------------ | ------- | ------------------------------------------------------------ |\n| status   | string | status of the delete operation .  |\n| bbox                            | array  | list of parameters of the bounding box for this product (on processedImage) |\n| label                    | string   | Label detection     |\n\n\n## Product Verification Service\n\n*[Example](examples/verify_product_from_image.py)*\n\nProduct verification service is used for comparing two images.\nA source image should contain only one product which will be compared to all products on the target image.\n\n**Methods:**\n\n### Verify\n\n```python\nproduct_verify.verify(source_image_path, target_image_path)\n```\n\nCompares two images provided in arguments. Source image should contain only one product, it will be compared to all products in the target image.\n\n| Argument            | Type    | Required | Notes                                                                                                                                                 |\n| ------------------  | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| source_image_path   | image   | required | file to be verified. Image can pass from url, local path or bytes. Max size is 5Mb                                           |\n| target_image_path   | image   | required | reference file to check the source file. Image can pass from url, local path or bytes. Max size is 5Mb                       |\n\nResponse:\n\n```json\n{\n    'status': 'completed',\n    'result': {\n        'source_image_product':\n        {\n            'embedding': [-0.03902999835598629, '...', -0.028654199455642616],\n            'bbox': [0, 0, 624, 773]\n        },\n            'product_matches':\n            {\n                'embedding': [-0.03902999835598629, '...', 5, -0.028654199455642616],\n                'bbox': [0, 0, 624, 773],\n                'verify': 'True',\n                'similarity': array([[0.]])\n        }\n    }\n}\n```\n\n| Element                        | Type    | Description                                                  |\n| ------------------------------ | ------- | ------------------------------------------------------------ |\n| source_image_product              | object  | additional info about source image product |\n| product_matches                   | array   | result of product verification |\n| embedding                      | array   | product embeddings.       |\n| box                            | object  | list of parameters of the bounding box for this product         |\n| verify  | boolean | failed or success          |\n| similarity                     | float   | similarity between this product and the product on the source image               |\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "DeepVision Python SDK makes face recognition into your application even easier.",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [
        "deepvision",
        "computer vision",
        "sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2f8896be4e95f11595faa6d26041341a88147752af343703857782920e3cc41",
                "md5": "8e23845222728f150a54d421a500cabc",
                "sha256": "f63449c6e404d998741fa31b774702ed1fc50d202e25081d3ef02f4be7b7c28f"
            },
            "downloads": -1,
            "filename": "deepvision_sdk-0.1.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8e23845222728f150a54d421a500cabc",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 76724,
            "upload_time": "2023-12-21T01:44:11",
            "upload_time_iso_8601": "2023-12-21T01:44:11.582747Z",
            "url": "https://files.pythonhosted.org/packages/a2/f8/896be4e95f11595faa6d26041341a88147752af343703857782920e3cc41/deepvision_sdk-0.1.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9e07d97bfc6f7f1095852952361c511f91c7c5299e556041fc40725bfab863d",
                "md5": "4ec2fc11e2820f57fd8f7248b52f5e31",
                "sha256": "6df038006a385d587355c44a1fd9d6cf9daa0fb9790dac1994ca7a0006058d86"
            },
            "downloads": -1,
            "filename": "deepvision-sdk-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4ec2fc11e2820f57fd8f7248b52f5e31",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 33533,
            "upload_time": "2023-12-21T01:44:13",
            "upload_time_iso_8601": "2023-12-21T01:44:13.375952Z",
            "url": "https://files.pythonhosted.org/packages/a9/e0/7d97bfc6f7f1095852952361c511f91c7c5299e556041fc40725bfab863d/deepvision-sdk-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-21 01:44:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "deepvision-sdk"
}
        
Elapsed time: 0.17698s