Skip to main content

PyPI - Python Version PyPI - Version PyPI - License PyPI - Status tests PyPI - Downloads

Logo


Spotipy - Accurate and efficient spot detection with CNNs

Installation

Install the correct tensorflow for your CUDA version.

Clone the repo and install it

git clone git@github.com:maweigert/spotipy.git
pip install spotipy

Usage

A SpotNet spot detection model can be instantiated from a custom Config class:

from spotipy.model import Config, SpotNet

config = Config(
        n_channel_in=1,
        unet_n_depth=2,
        train_learning_rate=3e-4,
        train_patch_size=(128,128),
        train_batch_size=4
    )

model = SpotNet(config,name="mymodel", basedir="models")

Training

The training data for a SpotNet model consists of input image X and spot coordinates P (in y,x order):

import numpy as np
from spotipy.utils import points_to_prob

# generate some dummy data 
def dummy_data(n_samples=16):
    X = np.random.uniform(0,1,(n_samples, 128, 128))
    P = np.random.randint(0,128,(n_samples, 21, 2))
    for x, p in zip(X, P):
        x[tuple(p.T.tolist())] = np.random.uniform(2,5,len(p))
    Y = np.stack(tuple(points_to_prob(p[:,::-1], (128,128)) for p in P))
    return X, Y

X,Y = dummy_data(128)
Xv,Yv = dummy_data(16)

model.train(X,Y, validation_data=[X, Y], epochs=10, steps_per_epoch=128)

model.optimize_thresholds(Xv,Yv)

Inference

Applying a trained SpotNet:

img = dummy_data(1)[0][0]

prob, points = model.predict(img)

Contributors

Albert Dominguez Mantes, Antonio Herrera, Irina Khven, Anjali Schläppi, Gioele La Manno, Martin Weigert

Metadata

Release files for spotipy-detector 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotipy-detector 0.1.0
File Size Uploaded
spotipy-detector-0.1.0.tar.gz 48.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotipy-detector 0.1.0
File Interpreter ABI Platform
spotipy_detector-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.6 kB

Release files / spotipy-detector-0.1.0.tar.gz

Download URL spotipy-detector-0.1.0.tar.gz
Size 48.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fa41bfe38ed98bf9445191f69bfb5bc49359b1fbce27952d7a201197c68ff342
BLAKE2b-256 checksum
How to use checksums
feaad0ad51a9cb7dfe95f69244daf91d847522d14cfa94e449947092fd982cf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.0

Release files / spotipy_detector-0.1.0-py3-none-any.whl

Download URL spotipy_detector-0.1.0-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8ffd7e4fe8eafc65701b16ed86477fc4efa7358f297bd93c315cceae3438597
BLAKE2b-256 checksum
How to use checksums
2b6e7990eea38a7cfbe8b9f73cc2400fa5f66aaf80b36f15bbbf653f476039e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page