Azure CustomVision cognitive service export model in TensorFlow is missing files - azure

I am using Azure Cognitive Services, aka CustomVision website, to create, train and test models. I understand the main goal of this site is to create and API which can be called to run your model in production. I should mention I am using this to do object detection.
There are times when you have to support running offline (meaning you don't have a connection to Azure, etc...). I believe Microsoft knows and understands this because they have a feature which allows you to export your model in many different formats (such as TensorFlow, ONNX, etc...).
The issue I am having is particularly when you export to TensorFlow, which is what I need, it will only download the frozen model graph (model.pb). However, there are times when you need either the .pbtxt file that goes along with the model or the config file. I know you can generate a pbtxt file but for that you need the .config.
Also, there is little to no information about your model once you export it, such as what the input image size should be. I would like to see this better documented somewhere. For example, is it 300x300, etc... Without getting the config or pbtxt along with the model, you have to figure this out by loading your model into a TensorBoard or something similar to figure out the input information (size, name, etc..). Furthermore, we don't even know what the baseline of the model is, is it ResNet, SSD, etc...
So, anybody know how I can get these missing files when I export a model? Or, anybody know how you can generate a pbtxt when all you have is the frozen graph .pb file?
If not, I would recommend these as improvements for the Azure Cognitive services team. With all of this missing data or information, it is really hard to consume the exported model.
Thanks!

Many model architectures allow you to change the network input size, such as Yolo, which is the architecture exported from Custom Vision. Including a fixed input size does somewhere does not make sense in this case.
Netron will be your good friend and pretty easy to use to figure out the details about the model.

Custom Vision Service only exports compact domains.For object detection exports there is code to load and run the object detection model in the zip file downloaded(model.pb,labels.txt). Along with the the export model you will find Python code to exercise the model.

Related

Get model download statistics for TFhub

I'm working on a tool for TF hub models and would like to test it on a representative sample of models. Is there a way do programmatically download a full list of TF hub models along with their download numbers (to judge popularity) other than scraping the website?
Also, I've noticed that the download numbers for some models (Ex: https://tfhub.dev/tensorflow/efficientnet/lite0/classification/2) are missing, and on a day-to-day basis, the download numbers sometimes go down. Is there any explanation for this?
There is no API to download all models or model stats. The bug regarding the decreasing download counts should be fixed by now.

Regarding container of form recogniser,OCR and labeltool containers

We are trying to use the container preview of form recogniser,OCR and labeltool and have following questions:
Is there any software which can help us to classify similar kind of documents. This will help us to categorize document and create training dataset
Is there any way to give the model user-defined name. Following is output from model query API.It is difficult to tie it back to different kind of models:
{
"modelId": "f136f65b-bb94-493b-a798-a3e8023ea1b5",
"status": "ready",
"createdDateTime": "2020-05-06T21:35:58+00:00",
"lastUpdatedDateTime": "2020-05-06T21:36:06+00:00"
}
I can see models file stored in \output\subscriptions\global\models where /output directory shared container in docker compose file. Is it possible to import this model to new containers.
Models have json and gz file with the same nae as model id
I am also attaching docker compose file for your reference
Is there way to fine tune or update same custom model(same model id) with model training data
We were also trying the labeltool but it only takes Azure blob as input. Is it possible to provide input same as we do for training of form recognizer.
We are struggling to get this setup and if it is not resolved we might to start looking to alternatives.
Following are answers to your questions:
To classify documents you can use custom vision to build a document classifier or use text classification and OCR. In addition you can use the Form Recognizer train without labels run it on the training data and use the cluster option within the model to classify similar documents and pages in the training dataset.
Friendly Model name is not yet available in Form Recognizer, its a future feature on our roadmap but not available yet.
Models can't be copied between containers, you can use the same data-set to train a model in a different container. Models can be copied between subscriptions, resources and regions when using the Form Recognizer cloud service.
Each train creates a new model ID in order not to overwrite the previous model you can't update existing models.
Form Recognizer v2.0 release is not yet available in containers, only Form Recognizer v1.0 release is currently available in containers. Form Recognizer v2.0 will be also available in containers shortly. When using containers release all the data remains on premise and the labeling tool once available for the v2.0 containers release will also take as input a local or mounted disk and not blob.
Thanks !
Neta - MSFT

Custom Vision save curent model

i'm using Custom vision from Microsoft service to classify image. Since the model will have to be re train few times a years, I would like to know if I can save current version of azure custom vision model to re train my new model on the same version? because I guess microsoft will try to increase performances of its service among time so model used on this tools will probably change...
You can export the model after each run, but you cannot use an existing model as a starting point for another training run.
So yes, as it is a managed service, Microsoft might optimize or somehow change the algorithms to train in the background. It is on you to decide if that works for you. If not, a managed service like this is probably generally not something you should use, but instead train your own models entirely.

How to add our own ML model into Stream.io or Stream Framework

We are researching Stream.io and Stream Framework.
We want to build a high-volume feed with many producers( sources) that include highly personal messages (private messages?)
For building this feed and to make this relevant for all subcribers we will need to use our own ML model for the feed personalisation.
We found this as their solution for personalisation but this might scale badly to allow us to run and develop our own ML model
https://go.getstream.io/knowledge/volumes-and-pricing/can-i
Questions :
1. How do we integrate / add our own ML model for a Getstream-io feed ?
2. SHould we move more to the Stream Framework and how do we connect our own ML model to that feed solution ?
Thanks for pointing us in the right directions !
we have the ability to work with your team to incorporate ML models into Stream. The model has to be close to the data otherwise lag is an issue. If you use the Stream Framework, you're working with python and your own instance of cassandra, which we stopped using because of performance and scalability issues. If you'd like to discuss options, you can reach out via a form on our site.

How to reuse existing models in LUIS

Since I cannot modify builtin models (entities, intents..) as provided by the LUIS.ai, How can I import them into my own model in a way that I can modify them further specific to my scenario(s).
Some of the contextual information can be found here: https://github.com/Microsoft/BotBuilder/issues/1694#issuecomment-305531910
I am using Azure Bot Service with Node.js
If you are using the new prebuilt domains, once you add them to your model, you should be able to tweak them.
If you are using the Cortana prebuilt app, I don't think you will be able to update it; however, the documentation contains some information if you want to "mimic" it.
If you explain exactly what are your scenarios, we might be able to come up with other alternatives.
I can't think of a straight-forward way to go about doing this, but you could take the .csv logs from LUIS and incorporate it into your model; at the least the response column data is in json format.

Resources