Using CuPy on a Mac to use DeepTrack2?

123 Views Asked by At

I want to use a framework I found on GitHub (https://github.com/softmatterlab/DeepTrack2), but when I start writing the code in Python, on my Mac, the error message appears:

UserWarning: cupy not installed, CPU acceleration not enabled warnings.warn("cupy not installed, CPU acceleration not enabled") zsh: illegal hardware instruction python Fluorescence.py

I tried to install cupy, but I'm on a Mac M1 and NVIDIA no longer supplies the drivers. What I find strange is that CuPy is not mentioned in the requirements (see attached).

tensorflow numpy matplotlib scipy Sphinx==2.2.0 pydata-sphinx-theme numpydoc scikit-image tensorflow-probability tensorflow-datasets more_itertools pint<0.20 pandas tqdm

I'm also sharing with you the code I'm trying to run, which is the first step in modelling a particle under a fluorescence microscope :


import deeptrack as dt
import matplotlib.pyplot as plt
import numpy as np
u = dt.units

particle = dt.PointParticle(
    position=(0, 0) * u.pixel,
    intensity=100
)

IMAGE_SIZE = 64

particle = dt.PointParticle(
    position=lambda: np.random.rand(2) * IMAGE_SIZE * u.pixel,
    intensity=100
)

fluorescence_microscope = dt.Fluorescence(
    NA=0.8,
    wavelength=680 * u.nm,
    magnification=10,
    resolution=1 * u.micrometer,
    output_region=(0, 0, IMAGE_SIZE, IMAGE_SIZE)
)

imaged_particle = fluorescence_microscope(particle)

output_image = imaged_particle()

plt.imshow(np.squeeze(output_image), cmap='gray')
plt.show()

imaged_particle.plot(cmap="gray")

imaged_particle.update().plot(cmap='gray')
plt.show()

How can i run this on my Mac M1?

0

There are 0 best solutions below