GithubHelp home page GithubHelp logo

mahiya / cognitive-image-search-sample Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 2.0 7.58 MB

Azure AI Search のベクトル検索機能を使った画像検索ソリューション

Python 23.96% Bicep 9.13% Shell 17.53% HTML 23.56% JavaScript 23.25% CSS 2.56%

cognitive-image-search-sample's Introduction

Azure AI Search ベクトル検索での画像検索ソリューション

概要

  • Keras の事前学習済みモデルの EfficientNet モデルを使用して画像をベクトル化します
  • ベクトル化した画像を Azure AI Search に格納して、ベクトル検索できるようにします
  • 検索クエリにベクトル化した画像を指定することで、似ている画像を検索できるようしています

Screenshot

必要な環境

利用方法

Azure AI Search 環境の作成

必要な環境を用意し、設定(Azure CLI での Azure テナントへログインなど)を行った後に、以下の様に、第一引数にリソースグループ名を指定して deploy.sh スクリプトを実行して AI Search のアカウントを作成して、cognitive_search_index.json での定義に従ってインデックスを作成します。

./deploy.sh [リソースグループ名]
# 例: ./deploy.sh rg-image-vector-search

また、スクリプトは Python アプリが使用する AI Search アカウントの情報を持つ cognitive_search_account.json と HTMLアプリ(Vue.js) が使用する static/settings.js を出力します。

Azure AI Search インデックスへのドキュメントの追加

Python の実行環境を用意します。requirements.txt に記載した Python パッケージをインストールします。Python の仮想環境として venv を使用する場合、以下のコマンドで用意できると思われます。

python -m venv .venv
source .venv/Scripts/Activate # Windows + Git Bash 環境の場合
pip install -r requirements.txt

以下の通り、upload_images.py を実行することで、static/imagesフォルダ配下にある JPG ファイルを EfficientNet を使ってベクトル化して、AI Search のインデックスへドキュメントとして登録します。

python upload_images.py

Web アプリケーションの起動

以下の通り、app.py を実行することで、Web アプリケーションを起動することができます。

python app.py

http://127.0.0.1:5000/へアクセスすることで、Web アプリケーションへアクセスすることができます。画像を選択すると、AI Search に登録されている画像のうち似ている画像が画面に表示されます。

cognitive-image-search-sample's People

Contributors

mahiya avatar

Stargazers

 avatar

Watchers

 avatar Kostas Georgiou avatar

Forkers

haiyunsky sawarae

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.