Skip to content

microsoft/dstoolkit-ComputerVision-ImageRetrieval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure_Vision_ImageRetrieval

This repository aims at giving sample code for vector search with Azure Computer Vision Image retrieval API and faiss.

Other reference:

How to use

  • Environmental setting

    • python libraries:
    pip install -r ./requirements.txt
  • API assumption

  • Configuration You need to prepare the config.yml file for configuration. Once you put values, please allocate it in the top directory of the repository:

        ## Flickr account
        flickr:
            API_KEY: <YOUR API KEY>
            API_SECRET: <YOUR API SECRET>
            NUMBER_OF_IMAGES: 100 ## How many images do you use?
            NUMBER_PROCESS_IMAGES: 10  ## Prepare for test
    
        image:
            folder: './downloaded_images'
    
        Azure:
            KEY: <YOUR API KEY FOR AZURE COMPUTER VISION>
            ENDPOINT: 'https://<YOUR CV RESOURCE NAME>.cognitiveservices.azure.com'
    
        faiss:
            dimension: 1024
            filename: 'imageIndex.pkl'
            top_N: 5 ## How many you use 
    
        meta_data:
            vectors_name: 'vectors.pkl'
    
        display:
            num_cols: 1 ## How many columns in displaying the result?
  • Run the codes!

    • If you succeed in running the notebook, you get the following result in the end.
      • image sample
      • Here are quick summary of the procedures:
        • Get several images in Flickr.
        • For the downloaded images, we append vector with vectorizeImage API.
        • Store the vectors in faiss, where we can query images after converting text or image into vector.
        • We put many people as argument of query_text of the method displayWithText. Then, the text is converted into vector with vectorizeText API, and it's used for searching pre-stored images.

Note: Environment setup

  • API refrence for azure-ai-vision
  • If python doesn't see the package, try: !pip show
    • Then, add the path as follows: sys.path.append('/anaconda/envs/azureml_py38/lib/python3.8/site-packages')

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published