Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshi committed Jun 12, 2019
1 parent 673cb6b commit 6ec6036
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 21 deletions.
64 changes: 45 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
3. [Step 1 - Prepare a increment.meta file](#Step-1---Prepare-a-increment.meta-file)
4. [Step 2 - Configure a OSS import setting parameters on Image Search instance](#Step-2---Configure-a-OSS-import-setting-parameters-on-Image-Search-instance)
5. [Step 3 - Execute OSS import](#Step-3---Execute-OSS-import)
5. [Step 4 - Test image search with your images](#Step-4---Test-image-search-with-your-images)
6. [Support](#support)


Expand All @@ -20,7 +21,6 @@ The goal of this tutorial is to explain how to import a large amount of image fi
### Local environment

* npm

* Node.js

In this tutorial, we use a tool to create a configuration file efficiently. To run it, you have to install [npm](https://github.com/npm/cli) and [Node.js](https://nodejs.org/) on your local machine. Please install them if you don't have.
Expand All @@ -36,9 +36,9 @@ node -v

### Alibaba Cloud

0. Alibaba cloud account
0. Alibaba Cloud account

You need an Alibaba cloud account. If you don't have any account, please follow
You need an Alibaba Cloud account. If you don't have any account, please follow
[this document to create one](https://www.alibabacloud.com/help/doc-detail/50482.htm).

1. Create an access key
Expand All @@ -57,7 +57,20 @@ node -v

## Step 1 - Prepare a increment.meta file

To import image files from OSS to Image Search instance, you have to create a configuration file called [incremant.meta](https://www.alibabacloud.com/help/doc-detail/66580.htm#h3-import-images). The file contains image list with import properties.
To import image files from OSS to Image Search instance, you have to create a configuration file called [incremant.meta](https://www.alibabacloud.com/help/doc-detail/66580.htm#h3-import-images). The file contains list of image import task configuration. Each task configuration corresponds to one image. The following parameters are in each task configuration.

* operator: This field specifies the action to be taken on the images. *ADD* means adding new images.
*DELETE* means removing images.

* item_id: It is an identification field for the image and must be unique. For product search, this field means the product ID. For generic search, this field specifies the image name.

* cat_id: It specifies category of the image. For product search, you can select the [category](https://www.alibabacloud.com/help/doc-detail/66623.htm) which the image belongs to. For generic search, the image category is always set to OTHERS, hence this field is useless.

* cust_content: This field specifies the custom content, which is read-only to the system and is displayed in the image search result. You can input any text you want that is releted to the image. For example, a description of the image like "Red dress for women".

* pic_list: It is an array which only contains one image file name. For example, ["sample1.jpg"].

To preapare a increment.meta file easier by the tool, please follow the steps:

1. Clone this repository

Expand All @@ -83,30 +96,34 @@ To import image files from OSS to Image Search instance, you have to create a co
1. Access to http://localhost:3000.

2. Input your credentials to the form.

* accessKeyId : The access key if of your Alibaba Cloud account

* accessKeySecret : The access secret if of your Alibaba Cloud account

* OSS region : The region of your OSS bucket

* OSS bucket : The name of your OSS bucket

* OSS bucket folder : the OSS bucket folder path which contains your images. By default, this tool get all images in the specified OSS bucket and put them into the list in increment.meta file. If you want to select an OSS bucket folder to filter the list, you can specify it.

![images/increment_meta_generator_form.png](images/increment_meta_generator_form.png)

You can check OSS region and bucket name from [OSS console](https://oss.console.aliyun.com/overview).

![images/oss_bucket_name_and_region.png](images/oss_bucket_name_and_region.png)

3. Submit the form to get the image list in your bucket.

4. Check the image list.
4. Check image list and change the following fields for each image if you need.
* ID : It corresponds to *item_id* in the increment.meta file.
* Category : It corresponds to *cat_id* in the increment.meta file.
* Custom content : It corresponds to *cust_content* in the increment.meta file.

![images/increment_meta_file_generator_imagelist.png](images/increment_meta_file_generator_imagelist.png)

Please note that because the tool is for OSS import, the field *operator* in the increment.meta file is input as *ADD* and the field *pic_list* in the increment.meta is generated automatically from the image name in OSS.

To preview your images, please set [ACL](https://www.alibabacloud.com/help/doc-detail/100676.htm) of the images to *Public Read*. Select a [category](https://www.alibabacloud.com/help/doc-detail/66623.htm) for each image if you want.
To preview your images, you have to set [ACL](https://www.alibabacloud.com/help/doc-detail/100676.htm) of the images to *Public Read* in your OSS setting.

5. Click a download link at the bottom.

The increment.meta file will be downloaded.
An increment.meta file will be downloaded.

![images/increment_meta_file_generator_download.png](images/increment_meta_file_generator_download.png)

Expand All @@ -125,17 +142,17 @@ To import image files from OSS to Image Search instance, you have to create a co

## Step 2 - Configure a OSS import setting parameters on Image Search instance

First, click the *Import* button at right-top corner.
First, click the *Import* button at top-right corner.

![images/image_search_instance_details.png](images/image_search_instance_details.png)

Then, a menu appears which has input boxes of setting parameters that you have to prepare for OSS import.
Then, a menu appears which has input boxes of setting parameters for import. You have to prepare them for OSS import.

![images/image_search_instance_oss_import_parameters.png](images/image_search_instance_oss_import_parameters.png)

1. ARN

You have to give some permissions to the Image Search instance. Please create a RAM role and input the ARN parameter.
You have to give some permissions to the Image Search instance. Create a RAM role and input the ARN parameter as an import setting parameter.

1. Access to [RAM Roles management console](https://ram.console.aliyun.com/roles).

Expand Down Expand Up @@ -179,20 +196,29 @@ Then, a menu appears which has input boxes of setting parameters that you have t

2. Bucket Name

Check the bucket name which contains your images from [OSS console](https://oss.console.aliyun.com/overview), and input the name to ImageSearch instance OSS import parameter input box.
Check the bucket name which contains your images from [OSS console](https://oss.console.aliyun.com/overview), and input the name as an import setting parameter.

3. Path

It represents the OSS bucket folder path. Check the bucket folder path which contains your images in your OSS bucket, and input the path to ImageSearch instance OSS import parameter input box. It must start with "/", for example "/bag". You have to input "/" if you put your images on root.
It represents the OSS bucket folder path. Check the bucket folder path which contains your images in your OSS bucket, and input the path as an import setting parameter. It must start with "/", for example "/bag". You have to input "/" if you put your images on root.


## Step 3 - Execute OSS import

After the configuration, click the *Import* button to execute OSS import. You can see your import history by click *Show Import History*.
After the configuration, click the *Import* button to execute OSS import.

Please note that **OSS import can be executed to only one OSS bucket folder by once**. The images listed in increment.meta file which are not in the specified *Path* will be ignored. If you want to import from multiple folders in OSS bucket, you have to change *Path* parameter and execute for each folder.

After import, you can see your import history by click *Show Import History*.

![images/image_search_instanct_import_history.png](images/image_search_instanct_import_history.png)

Please note that **OSS import can be executed to only one OSS bucket folder by once**. The images listed in increment.meta file which are not in the specified *Path* parameter will be ignored. If you want to import from multiple folders in OSS bucket, you have to change *Path* parameter and execute for each folder.

## Step 4 - Test image search with your images

At last, you can test image search with your images imported. Select the tab *Test Searvice*, select an image you want to search, click *Start Test*, and then you can get the result.

![images/image_search_instance_testservice.png](images/image_search_instance_testservice.png)


## Support
Expand Down
Binary file added images/image_search_instance_testservice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/increment_meta_generator_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Before creating the application, you need to prepare account credentials of Alib

2. Create a SSH key

You need a SSH key pair to access your ECS instance by Terraform. Please follow
You need a SSH key pair to access to your ECS instance by Terraform. Please follow
[this document to obtain an SSH key pair](https://www.alibabacloud.com/help/doc-detail/51793.htm). Please note the default target region of this sample is China(Qingdao).


Expand Down Expand Up @@ -139,7 +139,13 @@ Before creating the application, you need to prepare account credentials of Alib
1. Run Terraform
The terraform script will create the application on [ECS](https://www.alibabacloud.com/help/doc-detail/25367.htm).
Initialize the Terraform by running the following command:
```bash
terraform init
```
and run the following command to run the script to create the application on [ECS](https://www.alibabacloud.com/help/doc-detail/25367.htm).
```bash
terraform apply
Expand Down

0 comments on commit 6ec6036

Please sign in to comment.