README.md
Capricorn AI
Deep-learning based histopathology image classifier built with TensorFlow Keras.
Overview
Capricorn AI provides pre-trained Keras models for classifying H&E–stained tissue patches into diagnostic categories. It offers a simple Python API to load different model versions, run inference on images, and integrate into larger pipelines. PyPI link: https://pypi.org/project/capricorn-ai/
Installation
# Clone the repo
git clone https://github.com/SigMoses/Capricorn.git
cd capricorn
# Install dependencies
pip install -r requirements.txt
# Install TensorFlow (use the stable release or the tf-nightly build)
pip install tensorflow # or tf-nightly
# Install as a package
pip install capricorn-ai
Alternatively, install directly from GitHub:
pip install git+https://github.com/SigMoses/Capricorn.git
Quickstart
from capricorn_ai import list_models, load_model, load_image, predict
# List available models
print(list_models()) # ['capricorn0.1']
# Load an image
img = load_image('path/to/slide_patch.png')
# Run prediction
detections = predict('capricorn0.1', img)
print(detections)
Example Usage
from capricorn_ai import load_image, predict, ALL_LABELS, label_confidences
# Load and preprocess an image patch
img = load_image("path/to/patch.png")
# Run inference (returns shape (1, NUM_CLASSES))
probs = predict("capricorn0.1", img)[0]
# Print all label confidences in descending order
for label, confidence in label_confidences(probs):
print(f"{label:30s} {confidence*100:5.1f}%")
Available Models
- capricorn0.1: Initial version trained on PathMNIST subsets.
Add your own retrained models by placing the .keras file in capricorn_ai/ai_models/ and updating capricorn_ai/models.py.
Development & Testing
-
Dependencies are in
requirements.txt(installtensorflowortf-nightlyseparately). -
Run tests with:
pytest
Contributing
- Fork the repository.
- Create a new branch (
git checkout -b feature/my-model). - Add your
.kerasmodel incapricorn_ai/ai_models/and register it incapricorn_ai/models.py. - Update docs and add tests.
- Submit a pull request.
Credits
-
Original Progenitor
Capricorn AI was conceived and developed by Moshe Newman. -
Dataset
This project relies on the MedMNIST dataset. Please credit the MedMNIST team as follows:Jiancheng Yang, Rui Shi, Donglai Wei, Zequan Liu, Lin Zhao, Bilian Ke, Hanspeter Pfister, Bingbing Ni.
“MedMNIST v2—A large-scale lightweight benchmark for 2D and 3D biomedical image classification.” Scientific Data, 2023.Jiancheng Yang, Rui Shi, Bingbing Ni.
“MedMNIST Classification Decathlon: A Lightweight AutoML Benchmark for Medical Image Analysis.” IEEE 18th International Symposium on Biomedical Imaging (ISBI), 2021. -
Usage & Modification
You are free to modify or use this code as you please, provided that you retain proper credit to Moshe Newman as the original progenitor of Capricorn AI, and credit the MedMNIST team for the dataset as cited above.
License
Metadata
Release files for capricorn-ai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| capricorn_ai-0.1.1.tar.gz | 26.7 MB | Without provenance | Details for capricorn_ai-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| capricorn_ai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for capricorn_ai-0.1.1-py3-none-any.whl |
Total release size: 53.4 MB
Release files / capricorn_ai-0.1.1.tar.gz
| Download URL | capricorn_ai-0.1.1.tar.gz |
|---|---|
| Size | 26.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4e297e68c597acc9337b7fdd4ef4fb0fc4fdf9d6cc9757cadf8e3c1f5e2fc70
|
|
BLAKE2b-256 checksum How to use checksums |
fc04933177632b7c485c5dbd359ba78fe652ae556a7dab36f3843b3fad82efc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / capricorn_ai-0.1.1-py3-none-any.whl
| Download URL | capricorn_ai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 26.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71de1c412d887893a1a6258b7dc32c8648a900143ddfb994eee4fcc79a7fb638
|
|
BLAKE2b-256 checksum How to use checksums |
39a1be0c19c4e538c645bc470eeb6280ab70c03eb80dbdb80e745af2748dd501
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for capricorn-ai 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.