Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msioen/ai-tagger
A small mac utility to watch folders and automatically classify image documents.
https://github.com/msioen/ai-tagger
azureml machine-vision macos
Last synced: 16 days ago
JSON representation
A small mac utility to watch folders and automatically classify image documents.
- Host: GitHub
- URL: https://github.com/msioen/ai-tagger
- Owner: msioen
- License: mit
- Created: 2023-02-05T09:37:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-11T18:39:41.000Z (almost 2 years ago)
- Last Synced: 2024-11-08T05:39:53.479Z (about 1 month ago)
- Topics: azureml, machine-vision, macos
- Language: C#
- Homepage:
- Size: 1.58 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- project-awesome - msioen/ai-tagger - A small mac utility to watch folders and automatically classify image documents. (C# #)
README
# AI Tagger
![Icon](./resources/brain-colored-128.png)
![Icon](./resources/brain-128.png)AI Tagger is a macOS utility that can automatically tag images based on AI detected content.
![Demo](demo.gif)
## Get started
### Setup source code and resources
- Ensure the necessary mac bits are installed: `dotnet workload install macos`
- Ensure to pull in the git submodule: `git submodule update --init --recursive`.
- Pull down the lfs files: `git -C ml-endpoint/asset/model/donut-base-finetuned-rvlcdip lfs pull`
- In Azure create a 'Computer vision' resource and update the endpoints and credentials in AITagger/AppDelegate.cs.
- Ensure you have the [Azure Machine Learning CLI installed](https://learn.microsoft.com/en-us/azure/machine-learning/how-to-configure-cli?tabs=public)### Setup Azure Machine Learning endpoint - local
Note: the docker image needs enough resources to work with. Without enough CPU/RAM the internal process fails with a sigkill and you would get an internal server error back from the scoring endpoint. For my local tests I gave my docker engine 24GB memory and 10 CPU cores.
```bash
# login to Azure + set subscription (not necessary every time)
$ az login
$ az account set --subscription $SUBSCRIPTION
$ az configure --defaults workspace= group=# ensure you're in the correct folder
$ cd ml-endpoint# build the docker image which contains our model execution
$ docker build -f ./base/minimal-single-model-conda-in-dockerfile.dockerfile -t azure-ai-experiments/azure-donut-base-finetuned-rvlcdip:1 ./asset
$ docker tag azure-ai-experiments/azure-donut-base-finetuned-rvlcdip:1 $REGISTRY/azure-ai-experiments/azure-donut-base-finetuned-rvlcdip:1# create/deploy a local endpoint linked to your docker image
$ az ml online-deployment create --local --endpoint-name donut-rvlcdip -f ./base/minimal-single-model-conda-in-dockerfile-deployment.yml# get endpoint info to find out on what url/port it is running
$ az ml online-endpoint show -n donut-rvlcdip --local# validate endpoint - ensure to use endpoint from previous call
$ curl http://localhost:55001/score -F "[email protected]" -v
```### Setup Azure Machine Learning endpoint - cloud
Create following Azure resources: an Azure Machine Learning workspace and a container registry.
```bash
$ cd ml-endpoint# build the docker image which contains our model execution (same as local)
$ docker build -f ./base/minimal-single-model-conda-in-dockerfile.dockerfile -t azure-ai-experiments/azure-donut-base-finetuned-rvlcdip:1 ./asset# ensure to login to your docker registery
$ az acr login --name $REGISTRY# push the docker image to the registry
$ docker tag azure-ai-experiments/azure-donut-base-finetuned-rvlcdip:1 $REGISTRY/azure-ai-experiments/azure-donut-base-finetuned-rvlcdip:1
$ docker push $REGISTRY/azure-ai-experiments/azure-donut-base-finetuned-rvlcdip:1# create an online endpoint
$ az ml online-endpoint create -f ./base/minimal-single-model-endpoint.yml# deploy the online endpoint
$ az ml online-deployment create --endpoint-name donut-rvlcdip -f ./base/minimal-single-model-conda-in-dockerfile-deployment.yml --all-traffic# get endpoint info to find out on what url/port it is running
$ az ml online-endpoint show -n donut-rvlcdip --local# get the credentials neccessary to communicate with the endpoint
$ KEY=$(az ml online-endpoint get-credentials -n donut-rvlcdip --query primaryKey -o tsv)# get endpoint info to find out on what url/port it is running
$ az ml online-endpoint show -n donut-rvlcdip# validate endpoint - ensure to use endpoint from previous call
$ curl https://$ENDPOINT/score -H "Authorization: Bearer $KEY" -F "[email protected]" -v
```## Release notes
v1.0 (Feb 12, 2023)
- mac utility which listens to file changes
- no UI for settings - to be managed in code
- on new files: attempt to gain info about the image through AI
- AI Cognitive Services integration (vision client)
- AI Machine Learning integration (online endpoint with donut model)## Attributions
- Icons made by [Freepik - Flaticon](https://www.flaticon.com/authors/freepik).
- [Donut source code](https://github.com/clovaai/donut)
- [Hugging Face model](https://huggingface.co/naver-clova-ix/donut-base-finetuned-rvlcdip)