Python Code for Ensemble Model for Image Classification

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 มิ.ย. 2024
  • Model averaging is an ensemble technique where multiple sub-models contribute equally to a combined prediction. In this video, you will discover how to develop a stacked generalization ensemble for deep learning neural networks.
    A model averaging ensemble combines the predictions from multiple trained models. A limitation of this approach is that each model contributes the same amount to the ensemble prediction, regardless of how well the model performed.
    Link to download the dataset:
    www.kaggle.com/datasets/yasse...
    Link for Implementing Pre-trained Models for Image Classification:
    • Deep-learning in Healt...
    Python Code to Combine Pre-Trained Models:
    from tensorflow.keras.models import Model, load_model
    from tensorflow.keras.layers import Input, Average
    model_1 = load_model('/content/drive/MyDrive/model-01-0.9044.hdf5')
    model_1 = Model(inputs=model_1.inputs,
    outputs=model_1.outputs,
    name='name_of_model_1')
    model_2 = load_model('/content/drive/MyDrive/model-04-0.8156.hdf5')
    model_2 = Model(inputs=model_2.inputs,
    outputs=model_2.outputs,
    name='name_of_model_2')
    models = [model_1, model_2]
    model_input = Input(shape=(224, 224, 3))
    model_outputs = [model(model_input) for model in models]
    ensemble_output = Average()(model_outputs)
    ensemble_model = Model(inputs=model_input, outputs=ensemble_output, name='ensemble')
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Keep going excellent

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

    Amazing video

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

    Thanks a lot! It definitely helps..

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

    Good information. Thank you madam .

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

    nice explanation mam, plz elaborate how we can create a new learner algorithm ???
    Is there are multiple ways for that also????

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

    hello mam , how to use this model for unseen image(prediction image without class label) , because in this video i have seen that you have used image_daatset_directory(mostly its work for subdirectory) , if i have a test folder with unlabel images then how to use it for prediction.

  • @masroorahmedkorejo6834
    @masroorahmedkorejo6834 7 หลายเดือนก่อน +2

    Great Informative video. I would like to request you please make a videos using pretrained models with different ensemble techniques such as Bagging , stacking , and Boosting. Based on image dataset. Thanks

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

      i would like to request her to make different kind of the type of models using images and text by using inception, bert and MLP for example, please, look for forward from you madam

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

    at 8:39 load_model wali line mein path kaise define kia?

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

    Excuse Mam, Why Does My Code always make errors in the training model1? I turn on T4 GPU. Could you give me a solution to solve it? Thanks before.

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

    thank you madam

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

    I'm using anaconda and I'm a little bit confused on which kind of folder to use because there are 8 folders in the zip

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

    so this is bagging ensemble ?
    how about boosting ensemble

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

    How to use Voting Method? Please help...

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

    Hello madam, great information in this video. it is requested that kindly make a video on the stacking ensemble technique using DCNN models for image classification i have difficulty in implementing stacking ensemble techniques. Thank you so much for sharing for informative videos

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

    Mam i want to take the best weight and i save it using checkpoint. But when i am going to load the models for ensemble then it not loading. It work when i save entire model not only best weight.

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

    you didn't choose the VGG16 model in this case because its accuracy doesn't inproove so you used the inceptionV3 twice

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

    Nice explaination!! But I have one doubt kindly solve it plz
    From where did model 2 hdf5 file came as while training the accuracy of vgg16 i.e. model 2 is not improved so no hdf5 model is saved
    model_2 = load_model('/content/drive/MyDrive/model-04-0.8156.hdf5')

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

      train model 1 separately and model 2 separately and load the model and create ensemble model it works fine

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

      yes this is what i did @@investime247

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

    Mam I have one doubt please resolve that we are making a stacked ensemble model using the model average ensemble approach?. Here stacked ensemble approach means? Here both are different methods?

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

      stacked ensemble is different from model averaging. Stacked ensemble will have meta learner to come the predictions of the base learners. Average ensemble will find the average of all the predictions

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

      ​@@investime247how do we apply stacking ensemble to this type of problem? Do you have a tutorial on that?

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

    is this model fusion??

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

    Ma'am I am having trouble in implementing voting classifier such as decision tree and svm on my models such as vgg 16 .. please guide me

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

      what is the error?

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

      Maam thank you so much i have implemented your recent weight average ensemble in my project. Thank you so much

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

    model 2 is not improved so no hdf5 model is saved . can explain

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

      You can run seperate code for each model in different files and save separately. After that load the model and create ensemble

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

    now how to give input and check the output of the new test image?

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

      Pass the new test image in model.predict()

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

    Great work.
    Can you please share the code and dataset?

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

      github.com/hema2107/EnsembleModel

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

      @@investime247 ma'am can we apply it on binary dataset?

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

      @@hackandtech8918 yes use 2 instead os 8 in the dense layer for model1 and model2

    • @user-ts6py4ce4z
      @user-ts6py4ce4z 7 หลายเดือนก่อน

      ​@@investime247maam i am doing segmenting optical disc and cup for detection of glucoma using ensemble base method but i have isssue maam my model work but output fully black now

  • @knoberknoby
    @knoberknoby 28 วันที่ผ่านมา

    Mam, there are many potential flaws in your hybridization technique.

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

    hi can i save the ensemble model into .h5 file?

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

      I tried it gave error

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

      @@investime247 is there another way to save model ensemble?

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

      Try saving it as a pickle file instead of h5

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

    please share the code madam

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

    I was wondering if we have 8000 images, then how can we increase it to 12000.

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

      you can use an augmented pipeline and specify the number of images you want to generate
      th-cam.com/video/pyczpaJOuLU/w-d-xo.html

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

      ​@@investime247 good information i tried it on dataset of 6000 images with 4 classes but i faced overfitting for the results of ensemble model, could you please give me tips of how to overcome this issue i will be thankful for your help.

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

    Mam, can you please share the entire code.

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

      github.com/hema2107/EnsembleModel/blob/main/ensemble_inception_and_xception.py

  • @alienware-hq1oe
    @alienware-hq1oe ปีที่แล้ว

    Hello miss, please share the code.

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

      github.com/hema2107/EnsembleModel

    • @alienware-hq1oe
      @alienware-hq1oe ปีที่แล้ว

      @@investime247 Thank you :)