Image Classification Through Support Vector Machine (SVM) | Machine Learning

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ค. 2024
  • In this tutorial we are going to learn:
    1. Support Vector Machine as Image Classifier
    2. How to Save data by Pickle
    3. How to save model
    4. How to load saved model
    5. How to load data by pickle
    A Support Vector Machine (SVM) is a discriminative classifier formally defined by a separating hyperplane. In other words, given labeled training data (supervised learning), the algorithm outputs an optimal hyperplane which categorizes new examples.
    To understand SVM’s a bit better, Lets first take a look at why they are called support vector machines. So say we got some sample data over here of features that classify whether a observed picture is a dog or a cat, so we can for example look at snout length or and ear geometry if we assume that dogs generally have longer snouts and cat have much more pointy ear shapes.
    So how do we decide where to draw our decision boundary?
    Well we can draw it over here or here or like this. Any of these would be fine, but what would be the best? If we do not have the optimal decision boundary we could incorrectly mis-classify a dog with a cat. So if we draw an arbitrary separation line and we use intuition to draw it somewhere between this data point for the dog class and this data point of the cat class.
    These points are known as support Vectors - Which are defined as data points that the margin pushes up against or points that are closest to the opposing class. So the algorithm basically implies that only support vector are important whereas other training examples are ‘ignorable’. An example of this is so that if you have our case of a dog that looks like a cat or cat that is groomed like a dog, we want our classifier to look at these extremes and set our margins based on these support vectors.
    Credits: Andrew Nagi, Sentdex, Killian Weinberger
    Link of dataset :
    download.microsoft.com/downlo...
    #imageClassification #supportVectorMachine #MachineLearning

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

  • @umrnaveed
    @umrnaveed 3 ปีที่แล้ว

    AMAZING VIDEO. helped me a lot!! thank you

  • @Mockingbird416
    @Mockingbird416 3 ปีที่แล้ว

    really very helpful. it helped with my captcha reading project

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

    Finally a real project that accepts image. Thanks.

  • @aariskazi9002
    @aariskazi9002 2 ปีที่แล้ว

    Thank you sir for your demonstration it really helped me out

  • @sirithings143
    @sirithings143 3 ปีที่แล้ว

    Thanks for the video sir, it's helping alot😊

  • @layla7609
    @layla7609 2 ปีที่แล้ว

    Big Thanks for your effort sir !!

  • @stupid12366
    @stupid12366 2 ปีที่แล้ว

    Nicely explained sir
    Thank u so much

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

    sir, thank you so much for this video and your knowledge. you just saved the day:')

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

    Hey sir, Can I use this for classification of coid +ve and -ve Xray images ?

  • @mukullataroy2195
    @mukullataroy2195 3 ปีที่แล้ว

    Great video. For the cats & dogs dataset, with approx. 25k images of which 75-98% is training data, how long did your model fitting take? I am just beginning with classification in python, so I'm quite curious

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

    sir, can i know how the feature is extracted and why size[50,50] is given?

  • @pedrofumero7968
    @pedrofumero7968 3 ปีที่แล้ว

    How can we get the bounding boxes surrounding the predicted object?

  • @talhaabbasjalvi9572
    @talhaabbasjalvi9572 3 ปีที่แล้ว

    AoA sir can we give raw images to SVM like we do with CNN using ImageDataGenerator or it is neccessary to convert it to first pickle our dataset

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

    hello, please explain why accuracy without prediction array?

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

    How can u extract the label/class of a classified image when working with a large dataset? I would like to classify food image and recommend recipes based on the label identified but I am not understanding how to do this. I WOULD kindly ask a tutorial on this matter. There is barely information on food related projects plz

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

    thanks very easy lesson

  • @akashsinhaful
    @akashsinhaful 3 ปีที่แล้ว

    how to get the accuracy of the whole model

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

    Thank you soooo much sir for this video!!!! I have spent days in training my multiclass image classification model but using CNN but since my data set size was small I was not getting accuracy more than 40%.
    But after seeing this tutorial I have successfully trained my model with an accuracy of 87%. Once again thank you soooo much sir ❤

    • @isaiahdante7362
      @isaiahdante7362 2 ปีที่แล้ว

      I dont mean to be offtopic but does anybody know a method to get back into an instagram account?
      I was stupid forgot my login password. I would love any assistance you can give me.

    • @axtonsutton6290
      @axtonsutton6290 2 ปีที่แล้ว

      @Isaiah Dante instablaster ;)

    • @isaiahdante7362
      @isaiahdante7362 2 ปีที่แล้ว

      @Axton Sutton i really appreciate your reply. I found the site on google and im trying it out atm.
      Takes a while so I will get back to you later when my account password hopefully is recovered.

    • @isaiahdante7362
      @isaiahdante7362 2 ปีที่แล้ว

      @Axton Sutton WTF IT REALLY WORKED :O I literally hacked my ig password within about 40 mins of using the site.
      I had to pay 15 $ but definitely worth the price =)
      Thanks so much, you saved my ass :D

    • @axtonsutton6290
      @axtonsutton6290 2 ปีที่แล้ว

      @Isaiah Dante happy to help :)

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

    THANK YOU SO MUCH SIR, YOU SAVED MY LIFE FOR A UNI PROJECT, I AM GOING TO REMEMBER YOU FOREVER ❤❤❤❤ My teammates were going to kill me if I hadn't code a working SVM for our group project, you are my saviour!!!!!!!! Thank you for existing, because I literally visited like 30 websites with SVM code but I didn't understand them. You are so good and precious THANKS!!!! 😍😍❤❤

    • @sayyadimambee267
      @sayyadimambee267 2 ปีที่แล้ว

      Please can u share the basepaper or documentation of your project🙏🙏🙏🥺🥺🥺🥺🥺

  • @ranati2000
    @ranati2000 2 ปีที่แล้ว

    how are you extracting image features ?

  • @jayavikashkp5952
    @jayavikashkp5952 4 ปีที่แล้ว

    How many hours will it approximately take?

  • @faithmahere1168
    @faithmahere1168 2 ปีที่แล้ว

    Can this code be applied for satlight images

  • @michelleklatt8041
    @michelleklatt8041 2 ปีที่แล้ว

    How do I leave the picture in color, so that it can also be seen as a feature?

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

    Thanks for sharing. Really very usefull . Continue to produce such content 👍

  • @saivarun7298
    @saivarun7298 2 ปีที่แล้ว

    Can we do it for more than two classes?

  • @malhardharmadhikari5831
    @malhardharmadhikari5831 2 ปีที่แล้ว

    my image output is getting as just horizontal bars in gray scale any specific reason?

  • @jinipriya1981
    @jinipriya1981 3 ปีที่แล้ว

    Sir can you please make a video of how to classify bilogical medical images using SVM. Its really urgent and i will be highly obliged

  • @mastermind3778
    @mastermind3778 3 ปีที่แล้ว

    Select an image then give to model then it say cat or dog. How to implement this

  • @edward_7_3_9
    @edward_7_3_9 4 ปีที่แล้ว

    i get this error with thís code (=xtest[0].reshape(50,50) ) :(

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

    print('Simply Awesome out there')

  • @ridaiftikhar6879
    @ridaiftikhar6879 3 ปีที่แล้ว

    am getting error in line 55,how can i set?

  • @saikrishnavadali05
    @saikrishnavadali05 3 ปีที่แล้ว

    Hi can you please provide link to the code ?

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

    Can you implement the same CNN ? I read some articles where it's provide better accuracy .

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

    i have already done this using cnn, but came here to learn how to process color images through SVM. But you have converted it to GrayScale.

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

    hi sir, how do you calculate precision and recall for the model?

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

      you gotta make a copy of the first input data and calculate the norm of the expected data and first one.

  • @mutiullahjamil
    @mutiullahjamil 3 ปีที่แล้ว

    Nice video. if any one want to learn machine learning and computer vision or how to learn machine learning.

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

    Assalamualaikum, hope you are doing well. I'm facing this error,
    raise ValueError(
    ValueError: The number of classes has to be greater than one; got 1 class

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

    Sir, 1) what you have considered for features array..is it pixel values ??
    2) why have you flattened 2d array into 1d array??

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  3 ปีที่แล้ว

      1. Yeah
      2. Feature vectors are taken in 1d areay format in SVM. But you dont have to worry. Flattening the image don’t change its feature. It compares pixel to pixel.

  • @ghighighi
    @ghighighi 2 ปีที่แล้ว

    TypeError: __init__() got an unexpected keyword argument 'kernal'
    I get this error, may I know why? I am using Pycharm

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

    Please I want this code link

  • @samardas1365
    @samardas1365 4 ปีที่แล้ว

    Thank you ,By the way, How can i use surf and GIST extractor in this code to feature extraction

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  4 ปีที่แล้ว +2

      I didnt use them before for feature extraction. So i cannot suggest in that matter. In future i might have a look..

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

      @@md.iqbalhossain1594 if you can , please share with us. i am working on gist and surf extractor.and thank you for your video

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

    Sir, I am getting an error that "ValueError: setting an array element with a sequence.". How to address it?

    • @SaravananSaravanan-uw4vo
      @SaravananSaravanan-uw4vo 3 ปีที่แล้ว

      Which means every elements should be equal. Either array or sequence. I think In your model the elements are mixed. Make it array or remove the sequence index

  • @sauravbhardwaj7384
    @sauravbhardwaj7384 3 ปีที่แล้ว

    Sir gamma kyon use hota hai

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

    So How to read an image and categorize it? Thanks

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

      Thats why svm is for.

  • @anjanakmenon3014
    @anjanakmenon3014 3 ปีที่แล้ว

    But, why do you get a different accuracy each time you run the code? Is that a good accuracy?

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

      He is using 1% od the data to build a accuracy and is using "every" time a other picture. thats why he gets diffrent accuracys

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

    Why did u took test size 0.98?

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

    thanks for such an informative video, I copied your code for my project and following error appeared, can you guide? how to address it : ValueError: cannot reshape array of size 19200 into shape (50,50)

    • @yogeshwarshendye4857
      @yogeshwarshendye4857 3 ปีที่แล้ว

      You have to reshape the image using reshape function in CV2 library

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

    do you have a github link?

  • @saracamilalozanoserna5827
    @saracamilalozanoserna5827 4 ปีที่แล้ว

    I have followed this video but i get an error that says "ValueError: With n_samples=1, test_size=0.5 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters." is someone getting the same? how can I solve this ?

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  4 ปีที่แล้ว

      You have error while loading the data with utils.py... Check if u have data of desired length.. Use print(len(data)) to check total number of image array.

    • @saracamilalozanoserna5827
      @saracamilalozanoserna5827 4 ปีที่แล้ว

      @@md.iqbalhossain1594 thank you for your prompt response. I am working with a small dataset only to understand better and faster. right now the total number of image array is 40 (20 of each category ). It is the number I get using print(len(data)) so I think thats right.

  • @Akshay-cx6jx
    @Akshay-cx6jx 4 ปีที่แล้ว

    @iTech Combo could you share link of your code? I am am stuck at testing phase. I am facing this error:
    File "C:\ProgramData\Anaconda3\lib\site-packages
    umpy\core\_asarray.py", line 85, in asarray
    return array(a, dtype, copy=False, order=order)
    ValueError: setting an array element with a sequence.

    • @samopiyo7537
      @samopiyo7537 3 ปีที่แล้ว

      Getting similar error. were you able to resolve it?

    • @bryanandujar3683
      @bryanandujar3683 3 ปีที่แล้ว

      Same error

    • @samopiyo7537
      @samopiyo7537 3 ปีที่แล้ว

      @@bryanandujar3683 there are some files that are not images in the folders. Please delete them and try to run the code again.

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

      @@samopiyo7537 i solved mine, Image sizes must all be the same :)

    • @siddu6003
      @siddu6003 2 ปีที่แล้ว

      @@bryanandujar3683 how you did that ?

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

    Hlw sir your data set is not opening

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

    help me, Why does it only apply to grayscale images? Can it be applied to color images?

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  4 ปีที่แล้ว

      Yeah you can. But it will take more time to process.

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  4 ปีที่แล้ว +2

      I applied it to grayscale images so that it make the array of image small. For example: Colored image shape = 32x32x3. Grey image shape =32x32

    • @leminhhieu9764
      @leminhhieu9764 4 ปีที่แล้ว

      I tried reading the color images and flattening them, but when I reshape them, they seemed to display wrong.
      Ex:
      -> imread(' ', 1)
      -> resize(50, 50)
      -> flatten()
      -> reshape(50, 50, -1) -> It does not return to the original image. Why?
      How to return to the original image?

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  4 ปีที่แล้ว

      @@leminhhieu9764 it should work fine. Check the other places where you made the mistake.

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

    Dear Sir,
    Thank You for your work,
    Can you give us the github link of this project?
    Thank You again.

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

    Ok but why did u took only 1 class in lable? Why not dog?

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

    Hey interesting video! What if you have an image with both a cat and a dog? Can this be classified seperately?

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

      that will not be classfication task but identification.

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

      you could make another class called "cat and dog" where you have many samples of cat and dogs. Keep in mind that this would probably reduce the precision of your classifier

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

    the iconic boom boom boom😂

  • @sheshankpriyadarshi
    @sheshankpriyadarshi 3 ปีที่แล้ว

    BOOM BOOM

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

    Ran out of input. How to I fix it

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  4 ปีที่แล้ว

      Your error is of pickle file that exists, but is empty. Check if you are saving the data of image array in a right way.

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

      It's running sir

    • @machchanandhinis4130
      @machchanandhinis4130 4 ปีที่แล้ว

      But for multiple class the accuracy was poor.

    • @md.iqbalhossain1594
      @md.iqbalhossain1594  4 ปีที่แล้ว

      These are classical method. You should try deep learning to get better and fast result.

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

      @@md.iqbalhossain1594 ok sir . Thank you 😊👍

  • @ibrahimkenway1658
    @ibrahimkenway1658 2 ปีที่แล้ว

    The solution does not work!! and please for the love of god put the source code in the description.

  • @CowboyRocksteady
    @CowboyRocksteady 3 ปีที่แล้ว

    your poor keyboard.... sounds like it really takes a beating

  • @Patrick-wn6uj
    @Patrick-wn6uj 5 หลายเดือนก่อน

    the dataset website no long works🥲