If you are a domain expert in or machine learning practitioner who wishes to contribute to our efforts, thank you! 🙏 There are various ways you can help.
If you are a domain expert (physician, pathologist, radiologist, ...) and wish to help with this project, please let us know. We will get you in touch with teams working on data modelling who would be happy to use your assistance with better training our models.
You can also get in touch if you would like to use prototypes of our application and provide feedback to increase its relevancy to a clinical setting.
- Please write to us before get started on your work, so that we can tell you early on what is most useful and how best to get your work incorporated into the project.
- Clone its corresponding repository from
https://github.com/scancer-org/ml-<dataset>-<task>. - Modify the model architecture or hyperparameters, train and test your modified model.
- If you find that your model’s performance characteristics are better than the existing model, please submit a pull request with your improvements.
- Read the following section to learn how to package your new model and upload it to our model store.
- Please write to us before get started on your work, so that we can tell you early on what is most useful and how best to get your work incorporated into the project.
- Use one of the existing model repositories as a template for how to setup your repository.
- Develop, train, test your model.
- Carefully document it and provide example data for testing it.
- Let us know once you are done, and we will work with you to incorporate it as a model under the umbrella of the organisation, and give you access to our model store to upload your trained model.
- Read the following section to learn how to package your new model and upload it to our model store.
-
Output the weights of your PyTorch model in a very specific way, following this example for
pcam-classification:example_input = torch.rand(1, 3, 96, 96).to(device) traced_script_module = torch.jit.trace(model, example_input) traced_script_module.save("pcam-classification.pt") -
Write a handler file to deal with pre and post-processing of image data. Follow the template at ml-pcam-classification/todo/pcam-classification-handler.py.
-
Setup Torch Model Archiver:
pip install torchserve torch-model-archiver -
Archive your model into a TorchServe-friendly format:
torch-model-archiver --model-name pcam-classification \ --version 1.0 \ --serialized-file pcam-classification.pt \ --handler pcam_classifier_handler.py -
Upload your model archive to a suitable place on the web. If it is small enough (tens of megabytes), you can commit it directly to your GitHub repository as in our example at https://github.com/scancer-org/ml-pcam-classification/tree/main/models.
If it is larger, you can consider Git LFS or any other mechanism to host your file (e.g. Amazon S3).
The Scancer Project’s breast cancer detection model store can be found at https://model-store.scancer.org/. We have locked this behind authentication to maintain some control of access to it, but please write to us if you would like to use it. Send us a short description of your intended usage and we will be happy to get you setup with credentials.
Once you have credentials (username, password), you can interact
with it using a standard gRPC API. For each of
the following commands, you will be prompted for your password.
$ curl -u username https://model-store.scancer.org/models/
{
"models": [
{
"modelName": "pcam-classification",
"modelUrl": "https://github.com/scancer-org/ml-pcam-classification/raw/main/models/pcam-classification.mar"
}
]
}
$ curl -u username https://model-store.scancer.org/models/pcam-classification
[
{
"modelName": "pcam-classification",
"modelVersion": "1.1",
"modelUrl": "https://github.com/scancer-org/ml-pcam-classification/raw/main/models/pcam-classification.mar",
"runtime": "python",
...
}
]
$ curl -X POST -u username https://model-store.scancer.org/models/?url=https://github.com/scancer-org/ml-pcam-classification/raw/main/models/pcam-classification.mar
{
"status": "Model \"pcam-classification\" Version: 1.1 registered with 0 initial workers. Use scale workers API to add workers for the model."
}
$ curl -X PUT -u username https://model-store.scancer.org/models/pcam-classification?min_worker=2&max_worker=2
{
"status": "Processing worker updates..."
}
# Wait for a few seconds, and confirm that the workers are setup
$ curl -u username https://model-store.scancer.org/models/pcam-classification
[
{
"modelName": "pcam-classification",
"modelVersion": "1.1",
"modelUrl": "https://github.com/scancer-org/ml-pcam-classification/raw/main/models/pcam-classification.mar",
...
"workers": [
{
"id": "9000",
"startTime": "2021-05-01T11:46:23.500Z",
"status": "READY",
"memoryUsage": 0,
"pid": 395591,
"gpu": false,
"gpuUsage": "N/A"
},
{
"id": "9001",
"startTime": "2021-05-01T11:46:23.501Z",
"status": "READY",
"memoryUsage": 0,
"pid": 395588,
"gpu": false,
"gpuUsage": "N/A"
}
]
}
]
⛔ Please be very careful when attempting this.
$ curl -X DELETE -u username https://model-store.scancer.org/models/pcam-classification
{
"status": "Model \"pcam-classification\" unregistered"
}