Metadata-Version: 2.1
Name: castle-ai
Version: 0.0.9
Summary: Distinguish behavioral clusters Toolbox
Maintainer: Raiso Liu
Maintainer-email: rainsoon717@gmail.com
License: AGPL-3.0 license
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy
Requires-Dist: tqdm
Requires-Dist: torch
Requires-Dist: av
Requires-Dist: opencv-python
Requires-Dist: torchvision
Requires-Dist: matplotlib
Requires-Dist: umap-learn
Requires-Dist: h5py
Requires-Dist: natsort
Requires-Dist: gradio
Requires-Dist: plotly
Requires-Dist: hdbscan

# CASTLE


[![PyPI version](https://badge.fury.io/py/castle-ai.svg)](https://badge.fury.io/py/castle-ai)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CASTLE-ai/castle-ai/blob/main/notebooks/colab.ipynb)

CASTLE integrates the strengths of visual foundation models trained on large datasets possess open-world visual concepts, including Segment Anything (SA), DeAOT, and DINOv2, for one-shot image segmentation and unsupervised visual feature extraction. Furthermore, CASTLE employs unsupervised multi-stage and/or multi-layer UMAP clustering algorithms to distinguish behavioral clusters with unique temporal variability. 

# Install

## Step 1 install CASTLE core function
```
pip install castle-ai
```



## Step 2 (Speed Up) (not necessery)

for cuda12 user
```
pip install -U xformers --index-url https://download.pytorch.org/whl/cu121
pip install -U cudf-cu12 cuml-cu12 --extra-index-url=https://pypi.nvidia.com 
```

for cuda11 user
```
pip install -U xformers --index-url https://download.pytorch.org/whl/cu118
pip install -U cudf-cu11 cuml-cu11 --extra-index-url=https://pypi.nvidia.com 
```

## Step 3 Download Web UI
```
git clone https://github.com/CASTLE-ai/castle-ai.git
```

## Step 4 Download pretrain model

for Linux user
```
cd castle-ai/
bash download_ckpt.sh
```

for Windowns user
```
cd castle-ai/
mkdir ckpt
```
then using Web download model and put they into ckpt folder.


## Run
```
python app.py
```


# Reference

We would like to express our gratitude for the assistance received from the following projects during the development of this project.

[Segment Anything](https://github.com/facebookresearch/segment-anything.git)

[DeAOT & Segment-and-Track-Anything](https://github.com/z-x-yang/Segment-and-Track-Anything.git)

[DINOv2](https://github.com/facebookresearch/dinov2.git)
