freeda / main.py
lucabarsellotti's picture
First commit
081a09c
raw
history blame contribute delete
631 Bytes
import freeda
from PIL import Image
import requests
from io import BytesIO
if __name__ == "__main__":
fr = freeda.load("dinov2_vitb_clip_vitb")
response1 = requests.get("https://farm9.staticflickr.com/8306/7926031760_b313dca06a_z.jpg")
img1 = Image.open(BytesIO(response1.content))
response2 = requests.get("https://farm3.staticflickr.com/2207/2157810040_4883738d2d_z.jpg")
img2 = Image.open(BytesIO(response2.content))
fr.set_categories(["cat", "table", "pen", "keyboard", "toilet", "wall"])
fr.set_images([img1, img2])
segmentation = fr()
fr.visualize(segmentation, ["plot.png", "plot1.png"])