307 - Segment your images in python without training using Segment Anything Model (SAM)

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 มิ.ย. 2024
  • Segment your images in python without training using Segment Anything Model (SAM) by Meta AI
    Code from this video is available here: github.com/bnsreenu/python_fo...
    All other code: github.com/bnsreenu/python_fo...
    Useful links:
    SAM demo page: segment-anything.com/demo
    Blog page: / segment-anything-found...
    Github: github.com/facebookresearch/s...
    Trained models: github.com/facebookresearch/s...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 89

  • @datapro007
    @datapro007 ปีที่แล้ว +2

    Wow! I watched your video again and ran through the example you provided. SAM is a great annotation tool and a real labor saver. Fabulous presentation Sreeni.

  • @datapro007
    @datapro007 ปีที่แล้ว +3

    What a great and timely video. Thank you! I wasn't aware of SAM prior to seeing your presentation.

  • @Lalit-yw2tb
    @Lalit-yw2tb ปีที่แล้ว +16

    This model is brilliant. When I read the news, I was blown away that they made it open-source and allowing commercial use as well.
    We are living in wild times.
    As usual love your content Sreeni.

  • @jurischaber6935
    @jurischaber6935 ปีที่แล้ว +2

    Hey DigitalSreeni,
    I must thank you for your videos helping me a lot with my master thesis,
    I even got the best degree.
    Thanks....

  • @maxgadd
    @maxgadd ปีที่แล้ว +1

    your contributions are amazing. wow. thank you so much

  • @ozanapaydin15
    @ozanapaydin15 หลายเดือนก่อน

    Thank you for preparing this really really helpful tutorial and also teaching this model in a very simple way!

  • @user-ex3jt3sn5l
    @user-ex3jt3sn5l ปีที่แล้ว +1

    thanks a lot, it works great for my microscopic data, just very slow segmentation for live monitoring

  • @biswanathsaha2208
    @biswanathsaha2208 ปีที่แล้ว +4

    The model is so good, in our lab we need segmentation for multi-channel images, it definitely streamlines lot of things

    • @mohammedkrameche5378
      @mohammedkrameche5378 ปีที่แล้ว

      Do you think is can segment a set of elemental maps from EDS mapping?

  • @sara_kassani
    @sara_kassani ปีที่แล้ว +3

    ViT stands for Vision Transformers. I used UNETR and SwinUNTER (vision transformers) and both of them had excellent performance specifically if your dataset size is very small.

    • @faicalammisaid3705
      @faicalammisaid3705 ปีที่แล้ว

      i have 1600 pair image and mask dataset and i am having hard time with unet and others i might got to ViT and save time

  • @dr.aravindacvnmamit3770
    @dr.aravindacvnmamit3770 ปีที่แล้ว

    Excellent one superb

  • @yangyang6008
    @yangyang6008 ปีที่แล้ว +1

    Thank you for sharing! By the way, I like your Spyder IDE.

  • @hikvruzhunter2747
    @hikvruzhunter2747 ปีที่แล้ว +3

    Hi, could you make a tutorial on how to connect SAM outputs with convolutional networks to determine what object it is or extract information? Regards.
    Great video!

  • @gustavojuantorena
    @gustavojuantorena ปีที่แล้ว

    Thank you for the video

  • @carthagely122
    @carthagely122 3 หลายเดือนก่อน

    Thank you very much

  • @Brickkzz
    @Brickkzz 9 หลายเดือนก่อน

    A video for fine tuning Segement Anything Model would be great

  • @texasfossilguy
    @texasfossilguy ปีที่แล้ว +8

    How do you apply labels to them? Making a mask is one thing, but how do you label classes?

    • @aimenbahri9972
      @aimenbahri9972 4 หลายเดือนก่อน

      Use the sam model with yolov8

  • @niteshtakarker1976
    @niteshtakarker1976 8 หลายเดือนก่อน +1

    Thank you for the informative video tutorial! I'm currently working on agriculture land cover monitoring, and I'm wondering if this model can be used for that purpose. Can you confirm if it's suitable for agriculture land cover monitoring?

  • @senthilkumart.k8605
    @senthilkumart.k8605 ปีที่แล้ว

    Thank u for this excellent video sir. Currently this is doing instance segmentation. Is it possible to alter this code to perform semantic segmentation ?

  • @los4776
    @los4776 ปีที่แล้ว

    Thanks!

  • @shantilalzanwar8687
    @shantilalzanwar8687 7 หลายเดือนก่อน

    Nice one thanks

  • @rushirajparmar9602
    @rushirajparmar9602 ปีที่แล้ว +9

    Heyy, thanks Sreeni for your awesome content as always! BTW is there any way I can access a specific portion of mask from the segmentation mask dictionary?? Let's say if I just want to access the mask value where the person is in the image? This could also differ from image to image so I don't know if it works

  • @streamingdev1163
    @streamingdev1163 10 หลายเดือนก่อน +1

    I would love to know how they do the hover and onclick segment / mask

  • @aprashnani
    @aprashnani ปีที่แล้ว +1

    Does this make the other models we discussed on this channel, like UNet, ResNet etc., obsolete? Is it still worth it to learn about them?

  • @Syedneloyahmed
    @Syedneloyahmed 7 หลายเดือนก่อน

    Hello, Thanks for the great video. But I have a question, Can I export the masked output as shp or tiff format?

  • @sendtestsendtest4422
    @sendtestsendtest4422 ปีที่แล้ว

    thanks a lot

  • @tilkesh
    @tilkesh ปีที่แล้ว

    Thanks

  • @raphaelmachado9437
    @raphaelmachado9437 ปีที่แล้ว

    please more videos about this model 🙏

  • @sithibanu9019
    @sithibanu9019 4 หลายเดือนก่อน

    This is a useful information for my research. Sir can you make a video for prior setting like installing sam, transformer, checkpoints.

  • @jurischaber6935
    @jurischaber6935 ปีที่แล้ว +2

    Danke!

  • @ftmftm7627
    @ftmftm7627 ปีที่แล้ว

    Finally omg 😃 Sir please use pytorch

  • @edmald1978
    @edmald1978 ปีที่แล้ว +2

    To extract labels I did this function maybe can help:
    def create_labeled_mask(anns, height, width, max_num_classess):
    if len(anns) == 0:
    return

    sorted_anns = sorted(anns, key=(lambda x: x['area']), reverse=True)
    sorted_anns = sorted_anns[:max_num_classess]

    label = 1
    labeled_mask = np.zeros((height, width))

    for ann in sorted_anns:
    m = ann['segmentation']
    labeled_mask[m > 0] = label
    label += 1
    labeled_mask = labeled_mask.astype(np.uint8)
    return labeled_mask

    • @sudoshivam
      @sudoshivam ปีที่แล้ว +1

      SAM is segmenting multiple instances of same object in different colours. For ex. I tried SAM on an image containing many flowers, the model segments same type of flowers separately in different colours. So if I apply this function on my image it will assign different labels to all flowers even though they belong to same class.

  • @user-xl5zv9qp4g
    @user-xl5zv9qp4g ปีที่แล้ว

    Can you please show how to segment an object using the text prompt

  • @edmald1978
    @edmald1978 ปีที่แล้ว

    How to get the labels of the segmentation?

  • @domillima
    @domillima 4 หลายเดือนก่อน

    Do you any video where you show how to incorporate a (manual) segmentation from 3D slicer into a CNN using CT scans ?

  • @nyariimani7281
    @nyariimani7281 ปีที่แล้ว +1

    SWEEEEET!!! Thank you for this!

  • @elmerjaen
    @elmerjaen ปีที่แล้ว

    Great tutorial! Thanks for sharing. I would like to create a new cut out image based on the segmentation made by the model. The web demo of SAM already does this and I would like to do the same but using python. Any ideas in how should I attack this problem? Thanks in advance!😄

    • @anirudhgangadhar6158
      @anirudhgangadhar6158 ปีที่แล้ว

      Do you mean you want to create a binary image after segmentation ? You can just use the bounding box info. of the mask if that's the case.

  • @bharaths5603
    @bharaths5603 ปีที่แล้ว

    How does it work on images without dye staining?

  • @ajaypatro1554
    @ajaypatro1554 10 หลายเดือนก่อน +2

    Hy, sir I am from Geoinformatics background, and I want to get started with Py to process image processing on remote sensed data, where should I start what Gui would you recommend for Py Spyder or vs code is fine i want to visualize the data too while working on it.

  • @faicalammisaid3705
    @faicalammisaid3705 ปีที่แล้ว

    how to controle segmented classes like only houses or road and houses only

  • @prithvirajpani7190
    @prithvirajpani7190 ปีที่แล้ว

    Hi Sreeni. Thanks for this lively tutorial of SAM examples. May I know the GPU memory you have? I have run the house.jpg (which is 200KB) and neurons.jpg (which is examples on my CPU (with 16GB RAM) and they worked fine. But when I tried to work with an image that is 25MB size, my system reported as OOM. So, I was wondering if we need a high memory GPU or high RAM CPU to run this for even simple images?

    • @DigitalSreeni
      @DigitalSreeni  ปีที่แล้ว +1

      16GB GPU

    • @jlgiorio
      @jlgiorio ปีที่แล้ว +1

      @@DigitalSreeni Are you using GPU or CPU? My GPU (4GB) gave OOM for me too. Thank you in advance!

  • @itayhilel2168
    @itayhilel2168 ปีที่แล้ว

    can you do a video using the text prompt with the code?

  • @buketkaraoglu683
    @buketkaraoglu683 ปีที่แล้ว

    How can ı labelimg data using sam's mask output? Is this possible?

  • @vihalkaviyarau9044
    @vihalkaviyarau9044 5 หลายเดือนก่อน

    Hello. I am in need of binary segmentation. Can you do a video on that and explain it clearly like this. Thank you

  • @porchelvananbarasu1697
    @porchelvananbarasu1697 ปีที่แล้ว

    How to save the mask as vector or the masked image ?

  • @benoitchouinard4240
    @benoitchouinard4240 ปีที่แล้ว

    Hello, what kind of GPU are you using? I want to know if it's possible to do this in real time at at least 1Hz for video.

  • @AnoldMupa
    @AnoldMupa หลายเดือนก่อน

    Hi. I am trying to perform Slicing Aided Hyper Inference with the Segment Anything Model to detect smaller objects on an image. Is it possible?

  • @muhammadhuzaifa-11
    @muhammadhuzaifa-11 29 วันที่ผ่านมา

    How do I use this model either locally or via api?

  • @gracealkhawand5413
    @gracealkhawand5413 7 หลายเดือนก่อน

    CUDA works only on windows and linux apparently, is there a workaround to make it work for Mac, please?

  • @varunkota1289
    @varunkota1289 ปีที่แล้ว

    I don't have a GPU but I have a colab pro plus subscription, can I run this on Colab, can somebody tell me how I can do that please?

  • @ashav6590
    @ashav6590 10 หลายเดือนก่อน

    Sir, Getting error with sam chcekpoint please suggest how it can be resolved

  • @Eng_world
    @Eng_world 9 หลายเดือนก่อน

    Can we used this one on segmentation of geotiff file format data?

    • @mohajanemeriame1051
      @mohajanemeriame1051 4 หลายเดือนก่อน

      Hi , did you get reply, if yes please do share with me. Thank you

  • @user-lo1ii3um6l
    @user-lo1ii3um6l 9 หลายเดือนก่อน

    I use a MAC -> Anaconda -> Jupyter notebook. it says CUDA is available: False.
    How can i fix this?.

  • @tektronix475
    @tektronix475 ปีที่แล้ว +1

    Hey there ppl! . Is it possible to test the model in CPU? How?.
    I got an: CUDA is available: False warning trying to do that.Thx!

    • @tektronix475
      @tektronix475 ปีที่แล้ว +1

      m sorry, it took ages to segment with cpu, but finally made it.

  • @ChandreshTrivedi
    @ChandreshTrivedi ปีที่แล้ว

    Thank you.
    Other than the fact that it is open source, what advantage does this toolkit offer over Image-Pro and it’s programming environment for microscopy?

  • @johnnysmith6876
    @johnnysmith6876 ปีที่แล้ว +1

    Can you do binary segmentation using SAM?

    • @Feanor102
      @Feanor102 ปีที่แล้ว +1

      If you find anything could you please share it ?

    • @johnnysmith6876
      @johnnysmith6876 ปีที่แล้ว +1

      @@Feanor102 Will do!

  • @shantilalzanwar8687
    @shantilalzanwar8687 7 หลายเดือนก่อน

    I am getting CUDA FALSE, sorry but simple question, how to install it ?

  • @sarathkumar-gq8be
    @sarathkumar-gq8be ปีที่แล้ว

    how to measure the area of segmented image??

    • @DigitalSreeni
      @DigitalSreeni  ปีที่แล้ว +1

      Just sum up all the segmented pixels.

    • @sarathkumar-gq8be
      @sarathkumar-gq8be ปีที่แล้ว

      @@DigitalSreeni I do one project, for that I'm using kaggle alzheimer dataset using i do classification after classify I do segmentation,
      So here my point comes , I want measure the area of alzheimers in real world of kaggle dataset images , that how would I do sir??

  • @sofiavaldez500
    @sofiavaldez500 ปีที่แล้ว +1

    I would imagine researchers will want to use SAM to pre-process images for input into other models. But, it seems that SAM takes 20-30 seconds to segment images which is not feasible for thousands of training images. What are your thoughts on how SAM can be used in cases like these? Do you think there will be a way to speed up the segmentation per image?

    • @chironlionel6770
      @chironlionel6770 ปีที่แล้ว +2

      to annotate more quickly..

    • @raounekzeghdoud1023
      @raounekzeghdoud1023 ปีที่แล้ว

      @@chironlionel6770 Hi Lionel how can i use sam to annotate an image? thank you

    • @chironlionel6770
      @chironlionel6770 ปีที่แล้ว +1

      @@raounekzeghdoud1023 Hi Raounek, well in my case I have a GPU with 8MB of memory which is too small for using the main SAM model.. the intermediate one (which works on my GPU) does not for moment seem to be as good as the big model unhappily.. for a model I need around 20 pics so the time Sofia was speaking about is not for me a limitation.. also passing by SAM is always faster.. one disadvantage is when the objects are not well separated.. I need quite often to segment organisms which are stuck one to another and in this case I would be obliged to correct the masks since the model segment "too large".. To sum up I think it can be very useful if you are in the good conditions.. I tried also the One Shot Learning with perSAM but did not work as expected.. It could be a solution for making an annotating tool well customized ! but for the moment I don't manage this as good as I want but still quite promising !

    • @raounekzeghdoud1023
      @raounekzeghdoud1023 ปีที่แล้ว

      @@chironlionel6770 Thank you for your response and for clarifying. In my case, I have already extracted contours around each object from the segmentation. However, I am unsure about how to convert these contours into masks that can be used for annotations. Can you help me on this

    • @raounekzeghdoud1023
      @raounekzeghdoud1023 ปีที่แล้ว

      PS: i used another algorithem and not SAM

  • @Feanor102
    @Feanor102 ปีที่แล้ว +1

    I'm trying to create tumor segmentator with SAM. When i give mri images to it, it is segments anything in the images absolutely magnificently, but the problem is that it segments all the things and it does not gives any meaningful label. I can't distinguish the tumor masks among all the maskes. I don't know how to do it. I'm open to any suggestion. I apretiace.

  • @mohammedkrameche5378
    @mohammedkrameche5378 ปีที่แล้ว

    @DigitalSreeni an example for segmentation with training plz ?:D

  • @theforester_
    @theforester_ ปีที่แล้ว

    can we use tiff images?

  • @berndpeglow701
    @berndpeglow701 ปีที่แล้ว

    *promosm* 😂

  • @edmald1978
    @edmald1978 ปีที่แล้ว

    Thanks!

  • @bindurao3463
    @bindurao3463 ปีที่แล้ว

    Thanks

  • @sreehlalam
    @sreehlalam 2 หลายเดือนก่อน

    Thanks!