Image Similarity

Implemented with Microsoft Machine Learning Services

Template Contents


The following is the directory structure for this template:

  • data This directory is used to download images for this solution.
  • imagesimilarity This directory contains the imagesimilarity package used for the solution
  • Python This contains the Python code to prepare training/testing/evaluation set, train the multi-class classifier and evaluate the model.
  • Resources This directory contains other resources for the solution package.

Data


File Description
download_data.py Python script to download images named in the **fashion_texture_urls.tsv** file.
fashion_texture_urls.tsv list of images and their categorization to be downloaded.
download_data.bat Executes **download_data.py**

Image Similarity


This folder contains a Python package with helper functions that are used both in the **run_image_similarity.py ** code as well as the SQL Stored Procedures.

Model Development in Python


File Description
Train Model.ipynb Contains the Jupyter Notebook file that trains the model.
Test Model.ipynb Contains the Jupyter Notebook file that demonstrates the model.
copy_images_to_filetable.py Populates the SQL database with the image needed for training and testing the model
parameters.py Parameters used in run_image_similarity.py
run_image_similarity.py featurize images using pre-trained DNN model, prepare training/testing/evaluation image set, train a multi-class classifier and save the model into SQL table, evaluate the image ranking system using evlauation image set, and return top K similar candidates for new query images

Operationalize in SQL Python


Stored procedures in SQL implement the model training workflow.

Resources for the Solution Package


File Description
.\Resources\ActionScripts\ConfigureSQL.ps1Configures SQL, called from ImageSimilaritySetup.ps1
.\Resources\ActionScripts\CreateDatabase.sqlCreates the database for this solution, called from ConfigureSQL.ps1
.\Resources\ActionScripts\CreateSQLObjectsPy.sqlCreates the tables and stored procedures for this solution, called from ConfigureSQL.ps1
.\Resources\ActionScripts\ImageSimilaritySetup.ps1Configures SQL, creates and populates database
.\Resources\ActionScripts\installPyPkg.batInstalls the imagesimilarity Python package
.\Resources\ActionScripts\LoadImageData.ps1Used to trigger the download of images, upload to SQL, and run the solution workflow.
.\Resources\ActionScripts\RunOnce.cmdUsed to run LoadImageData.ps1 the first time a user logs onto the VM.
.\Resources\ActionScripts\SolutionHelp.urlURL to the help page.

< Home