MoritzWillig / pysnic

Python implementation of the SNIC superpixels algorithm
MIT License
54 stars 5 forks source link

How can I install PySNIC in Google Colab? #10

Open fellipeassuncao opened 2 years ago

fellipeassuncao commented 2 years ago

I tried to execute the command: !pip install pySNIC and the instalation seems to be effective, but when I call the lib with from asnic import generate_seeds the 'ModuleNotFoundError ' appear. How can I fix it?

MoritzWillig commented 2 years ago

In your example you import asnic instead of pysnic. Also the function to generate an equidistant grid of seeds is called compute_grid in this repository and has to be imported from the helpers:

from pysnic.helpers.grid import compute_grid
from itertools import chain

num_seeds = 100
grid = compute_grid(my_image.shape, num_seeds)
seeds = list(chain.from_iterable(grid))

Please let me know if the problem persists! Otherwise I have just tested it to work with python 3.9.7 and pip 21.2.4 (not on Google Colab though).

fellipeassuncao commented 2 years ago

Perfect! You were fast and precise! I'd want to generate seeds from an image and you understood it fastly! It's worked! Now I want understand I if I'm able to use these seeds as input in my segmenation algorithm that use seeds. I will think about it... Thanks!