Skip to content

Instantly share code, notes, and snippets.

@rajivpo
Last active May 21, 2018 21:41
Show Gist options
  • Save rajivpo/4eb1eb7e1381c11fd059d86b18bf0a66 to your computer and use it in GitHub Desktop.
Save rajivpo/4eb1eb7e1381c11fd059d86b18bf0a66 to your computer and use it in GitHub Desktop.

us-model-checker

us-model-checker is a project that performs some basic error checks for a Open Ultrasound Assistance Model (OAUM) Specification. Namely, it ensures that a manifest.json is present and in JSON, the entry point for the memory-mapped TensorFlow graph is valid, and that specific keys ('name', 'model_version', 'resolution', 'dimensionality', 'output_type', 'is_memory_mapped', and 'data_format') are present and take appropriate values.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

You will need to have git, python 2.7.x, and npm installed.

Installing

Clone the repo

git clone _________________

Navigate to the cloned repository and install the Javascript dependencies

npm install

Activate your virtualenv and then install the python dependencies

pip install -r requirements.txt

The last thing left to do is start the flask server. From manifest-check directory, do the following:

cd backend/app
export FLASK_APP=zipCheck.py
flask run

Example

To use this application, open the index.html from this project into your browser of choice. You should have a webpage that looks like this: alt-text

Now, click choose file, and select your zipped file and results should appear.

Currently, this is not deployed in the cloud. When it is, the link will be provided HERE.

Common Errors

Error Message Fix
'valid_zip' The file provided is not a zip file Upload a zip file
'valid_manifest_json' No manifest.json included Create/include a manifest.json in the uploaded zip file
'valid_manifest_json' The manifest.json is not encoded in JSON Encapsulate all keys and values in quotes
'model_version' Specified 'model_version' is an int The OUAM uses semantic versioning. All ints should be floats (e.g. 2 -> 2.0)
'model_version' Specified 'model_version' is not a float The value for the key 'model_version' is not an int or float (e.g. 'one')
'model_version' Key 'model_version' does not exist in manifest.json Include 'model_version' as a key in manifest.json
'resolution' The specified resolution must be NATIVE The value associated with the key resolution in manifest.json MUST be 'NATIVE'. No other resolutions are currently supported by the OAUM.
'resolution' Key 'resolution' does not exist in manifest.json Include 'resolution' as a key in manifest.json
'dimensionality' Dimensionality is not 2D or 3D The value associated with the key resolution in manifest.json MUST be '2D' or '3D'
'dimensionality' Key 'dimensionality' does not exist in manifest.json Include 'dimensionality' as a key in manifest.json
'orientation' Orientation is not 'GENERAL' or 'CARDIOLOGY' The value associated with the key 'orientation' MUST be 'GENERAL' or 'CARDIOLOGY'
'orientation' Key 'orientation' does not exist in manifest.json Include 'orientation' as a key in manifest.json
'model_file' File path associated with model in manifest.json is invalid Change the file path to match the memory mapped TensorFlow graph or include the memory mapped TensorFlow graph at the address provided
'model_file' Key 'model_file' does not exist in manifest.json Include 'model_file' as a key in manifest.json
'is_memory_mapped' Model has not been memory mapped or is not reflected in manifest.json The value associated with 'is_memory_mapped' MUST be 'true'
'is_memory_mapped' Key 'is_memory_mapped' does not exist in manifest.json Include 'is_memory_mapped' as a key in manifest.json
'data_format' Currently, only 'NCHW' is supported as a valid data format Change 'data_format' value to 'NCHW'
'data_format' Key 'data_format' does not exist in manifest.json Include 'data_format' as a key in manifest.json

Tests

A set of unit tests for which has validated this code is provided in backend/app/validateZipUnitTest.py. It is included for purely for those who may be interested.

Built With

  • React - The frontend framework
  • Flask - The web framework used

Live Version

Currently, there is not a live version of this code. Sometime soon, it will be deployed and the URL for the live version will be updated here.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Rajiv Patel-O'Connor - Initial work - rajivpo

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment