Plant Disease Detection System Part-4 | Training Image Recognition Model using Tensorflow

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 96

  • @aryanpatel8140
    @aryanpatel8140 4 дня назад +1

    I can't increase the no pf neurons in hidden layer as it shows oom out of memory and earlier it used to run just fine
    Please help me

  • @ASRITHAKASIREDDY
    @ASRITHAKASIREDDY 8 месяцев назад +4

    even after doing all the three steps in model iam still facing issue sir....Each epoch is running for about 30 min..Iam executing this code in vs code?

  • @aryanpatel8140
    @aryanpatel8140 4 дня назад +1

    That stupid hidden layer line is showing oom out of memory
    Earlier it was working just fine and now i have been stuck here for the past 3 hours and it is not working

  • @aryanpatel8140
    @aryanpatel8140 4 дня назад

    Sir i am using a different dataset in which my final accuracy is 22% and loss is 1.87 and loss doesn't increase or decrease it remains the same
    What do i do to increase the accuracy and minimize the loss

  • @gurukiran488
    @gurukiran488 Месяц назад +2

    sir please can you share the list of algorithms other than cnn ..

  • @JeevanEG
    @JeevanEG 7 месяцев назад +2

    hello ,sir instead of tf.keras.utils.image_dataset_from_directory to load images i used Image Data generator with flow from directory() , but when i trained the accuracy on traning data is very low like 6% , i had taken same dataset and same value that you have given then also i am facing issuse ?? can you help

    • @SPOTLESSTECH
      @SPOTLESSTECH  6 месяцев назад

      For flow_from_directory you have to give parameter value correctly according to your use case

  • @rijux5034
    @rijux5034 Месяц назад +2

    sir one error is coming "validation_set" not defined. wht to do with that?

    • @SPOTLESSTECH
      @SPOTLESSTECH  Месяц назад

      Run cell where we have defined it then run curr cell it will not come

  • @arpitkadam6026
    @arpitkadam6026 2 месяца назад +2

    ValueError: Arguments `target` and `output` must have the same rank (ndim). Received: target.shape=(None, 38), output.shape=(None, 3, 3, 38)
    What should I do sir??

    • @SPOTLESSTECH
      @SPOTLESSTECH  2 месяца назад

      Are you using same dataset and following video step by step
      Check i have printed shape of training set before starting building model check and debug it

  • @aryanpatel8140
    @aryanpatel8140 4 дня назад +1

    It feels like the more i run this model to change things the more slow it becomes and now even if i increase the neurons to 1500 it shows oopm(memory not available) but before it even ran 3000
    Please any solution

    • @SPOTLESSTECH
      @SPOTLESSTECH  4 дня назад

      Try to run code after restarting kernel
      And what is your model size ?

    • @aryanpatel8140
      @aryanpatel8140 4 дня назад

      Mine only has 1750 images@@SPOTLESSTECH

    • @aryanpatel8140
      @aryanpatel8140 4 дня назад

      ​@@SPOTLESSTECHdid that still didn't work
      My data only has 1750 images and now only 50 neurons are working if i add more than that it shows OOM out of memory

  • @kunalsood5843
    @kunalsood5843 17 дней назад +1

    in my case there is overfitting instead of overshooting any idea

    • @SPOTLESSTECH
      @SPOTLESSTECH  17 дней назад

      Add dropouts layer
      Decrease model complexity
      You can add kernel regularizer in neural network layers

  • @devansh2303
    @devansh2303 2 месяца назад +3

    Why is it taking too much time for accuracy to load ... For the 1st epoch only it's taking half an hour

    • @SPOTLESSTECH
      @SPOTLESSTECH  2 месяца назад +1

      Looks like you are training on cpu
      If you don’t have try on google colab change runtime to T4

    • @devansh2303
      @devansh2303 2 месяца назад

      @@SPOTLESSTECH runtime T4 means ?... Epoch=4 insted of 10?

    • @devansh2303
      @devansh2303 2 месяца назад

      Can the project run on vs code?

    • @dreamsteamgorakhpur9899
      @dreamsteamgorakhpur9899 Месяц назад

      @SPOTLESSTECH its take to much time how to resolve this problem

  • @RossGeller15
    @RossGeller15 7 месяцев назад +2

    here what do you mean by training_set and validation_set
    in model fitting

    • @SPOTLESSTECH
      @SPOTLESSTECH  7 месяцев назад

      Training set are the set of dataset used for training
      While for monitoring the accuracy on unseen data we used validation set
      So what’s happening here in simple words
      1. Training set data used for training model and adjusting its weights according to label(class_name)
      2. Validation set used to see the model accuracy it is data which is unseen to the model

  • @dewanshi7724
    @dewanshi7724 8 месяцев назад +1

    In the train_plant_disease.jpynb notebook the program runs till saving model correctly and agter that the kernel dies and restarts again and the accuracy visualization codes don't run and they give errors. Please help me solve this problem asap

    • @SPOTLESSTECH
      @SPOTLESSTECH  8 месяцев назад

      You have to run 3 cell simultaneously
      1. model.fit()
      2. Model.save()
      3. Recording history
      During training cell-2,3 will be queued and it will run after model training
      Once history saved in your local you can load your json and perform visualization
      That is the significance of saving history
      Reason for this : Model training is taking 30-40 min or more than this depends on your pc architecture
      So basically what’s happening after model training your kernel dies due to high usage of your pc and it want to get restarted so you have to run all this 3 cell
      So that after running this 3 cell it dies
      So that you can restart and continue with your json file and then visualization

  • @mukesh-cl5hy
    @mukesh-cl5hy 7 месяцев назад +1

    Bro I am getting an error in model.fit like
    ValueError: Shapes (None, 1) and (None, 38) are incompatible

    • @SPOTLESSTECH
      @SPOTLESSTECH  7 месяцев назад

      Check output layer number of neuron whether it is equal to number of classes

    • @mukesh-cl5hy
      @mukesh-cl5hy 7 месяцев назад

      ​@@SPOTLESSTECHDataset downloaded only 50% into my system. Is that a problem for this error?

    • @devansh2303
      @devansh2303 2 месяца назад

      Could you please elaborate what should I do sir in this kind of error​@@SPOTLESSTECH

  • @TishaJain-i5h
    @TishaJain-i5h 6 месяцев назад +2

    If i will use google colab can i deploy it?

    • @SPOTLESSTECH
      @SPOTLESSTECH  6 месяцев назад

      Yes you can

    • @TishaJain-i5h
      @TishaJain-i5h 6 месяцев назад +1

      @@SPOTLESSTECH I am trying the same process in colab but it is taking time... Can't we compress the size of input data to make training fast

    • @SPOTLESSTECH
      @SPOTLESSTECH  6 месяцев назад +1

      It affect model accuracy
      Did you uploaded your data on drive and accessing drive via google colab
      Also you have changed runtime of colab to T4 ??
      If you have not done this two things then model will take time

  • @Supriyanayak21
    @Supriyanayak21 2 месяца назад +1

    I got the value error
    That the exception encountered when calling conv2D.call()
    Input=tf.tensor(shape(none,2,2,512),dtype=float32)
    What i will do??

    • @SPOTLESSTECH
      @SPOTLESSTECH  2 месяца назад

      What input shape you are using ?

    • @Supriyanayak21
      @Supriyanayak21 2 месяца назад

      ​@@SPOTLESSTECHas per your instruction I used the same input shape

    • @Supriyanayak21
      @Supriyanayak21 2 месяца назад

      Again the another error is showing that valuerror:'target' and 'output' must have same shape.Recived:target.shape=(None,20),output.shape=(None,38).
      What shall I do😢😢??

    • @SPOTLESSTECH
      @SPOTLESSTECH  2 месяца назад

      @@Supriyanayak21 In Output layer number of units (which is number of neuron) must be equal to number of classes present in dataset
      There is mismatch in neuron of last output layer check whether its equal to no of classes or not

  • @Md.ShahriarIslam-ip2xr
    @Md.ShahriarIslam-ip2xr 4 месяца назад +1

    While printing training history val_loss, val_accuracy does not printing. How can I show this?

    • @SPOTLESSTECH
      @SPOTLESSTECH  4 месяца назад +1

      Model.fit() return loss accuracy in each epoch in dictionary format
      Definitely it has to return if model training is completed successfully

    • @Md.ShahriarIslam-ip2xr
      @Md.ShahriarIslam-ip2xr 4 месяца назад

      @@SPOTLESSTECH It worked. Thank you

    • @Md.ShahriarIslam-ip2xr
      @Md.ShahriarIslam-ip2xr 4 месяца назад

      @@SPOTLESSTECH Which architecture in CNN do you use for model train & test like VGG16, VGG19, ResNet50 etc.?

  • @NikhilYadav-du6wn
    @NikhilYadav-du6wn 7 месяцев назад +1

    my dataset is small compared to yours I'm getting 99 percent training accuracy and 49 percent validation accuracy.
    any suggestions how can I improve my validation accuracy?

    • @SPOTLESSTECH
      @SPOTLESSTECH  7 месяцев назад

      Your model overfits
      Add dropouts layer reduce number of deep layers/reduce neurons in deep NN layers and try
      I also faced same in my previous project watch this
      Fruits and Vegetables Recognition System Part-9 | Improving Deep Learning Model Performance
      ruclips.net/video/FTBVsYg_FVg/видео.html

    • @NikhilYadav-du6wn
      @NikhilYadav-du6wn 7 месяцев назад +1

      @@SPOTLESSTECH thanks brother

  • @moheeuddeenansari9640
    @moheeuddeenansari9640 6 месяцев назад +1

    does your laptop gets over heat easily

    • @SPOTLESSTECH
      @SPOTLESSTECH  6 месяцев назад

      I am using Macbook M2 chip
      So its running fine for this architecture
      But yes if you are doing experiments and changing parameters and retraining then sometimes yes

  • @rishisuryavanshi6357
    @rishisuryavanshi6357 2 месяца назад +1

    What can I do if my model is overfitting?

    • @SPOTLESSTECH
      @SPOTLESSTECH  2 месяца назад

      Reduce model complexity by adding dropouts
      Use techniques called regularization using tensorflow u can easily do these things
      If still things not working then feed more data and make it more generalised

  • @amirkhankhattak4292
    @amirkhankhattak4292 8 месяцев назад +1

    bro what are the specs of your device?
    because in mine it takes so much time in model.fit any reason why

    • @SPOTLESSTECH
      @SPOTLESSTECH  8 месяцев назад

      You need GPU to train your model
      I am using Mac M2 chip device
      If you don’t have gpu support try using it from google colab

    • @amirkhankhattak4292
      @amirkhankhattak4292 8 месяцев назад +1

      @@SPOTLESSTECH i have a gpu bro still it takes take time
      does model by default use gpu if detected or whether we have to write a code accordingly?
      thank you for getting back to me.

    • @amirkhankhattak4292
      @amirkhankhattak4292 8 месяцев назад +1

      @@SPOTLESSTECH i have 2gpus one is is intel r hd graphics other one is Geforce 930 MX but they are not utilized

    • @SPOTLESSTECH
      @SPOTLESSTECH  8 месяцев назад +1

      Try this and let me know
      www.freecodecamp.org/news/how-to-setup-windows-machine-for-ml-dl-using-nvidia-graphics-card-cuda/

    • @amirkhankhattak4292
      @amirkhankhattak4292 8 месяцев назад +2

      @@SPOTLESSTECH bro above link is insightful but i trained the model on kaggle they are providing gpu free of cost. thank you for helping me out.

  • @RpitPlays
    @RpitPlays 4 месяца назад +1

    my error is
    ValueError: Arguments `target` and `output` must have the same rank (ndim). Received: target.shape=(None, 38), output.shape=(None, 8, 8, 38)
    How must I overcome this?

    • @SPOTLESSTECH
      @SPOTLESSTECH  4 месяца назад

      Check output layer and write number of neurons equal to number of classes

    • @arpitkadam6026
      @arpitkadam6026 2 месяца назад

      @@SPOTLESSTECH how can we exactly do that because I have set the no. of neurons as same as you

    • @aneekeshraj6859
      @aneekeshraj6859 2 месяца назад

      @@arpitkadam6026 problem solve hua??

  • @shashankgosavi7876
    @shashankgosavi7876 2 месяца назад +3

    my each epoch is taking 1:30 hr i am also using m2 mac

    • @SPOTLESSTECH
      @SPOTLESSTECH  2 месяца назад

      Check model architecture by doing model.summary
      And are you using tensorflow-gpu
      Check list of installed packages

  • @Khalid0001-f3b
    @Khalid0001-f3b 5 месяцев назад +1

    sir i get error during compiling the code
    ImportError(
    116 "`keras.optimizers.legacy` is not supported in Keras 3. When using "
    117 "`tf.keras`, to continue using a `tf.keras.optimizers.legacy` "
    118 "optimizer, you can install the `tf_keras` package (Keras 2) and "
    119 "set the environment variable `TF_USE_LEGACY_KERAS=True` to "
    120 "configure TensorFlow to use `tf_keras` when accessing `tf.keras`."
    such error shown in this code : " model.compile(optimizer =tf.keras.optimizers.legacy.Adam(learning_rate=0.0001) , loss = 'categorical_crossentropy', metrics = ['accuracy']) "

    • @SPOTLESSTECH
      @SPOTLESSTECH  5 месяцев назад +1

      Instead of that write optimizer=‘adam’
      And run the code

  • @gunmaypaul6715
    @gunmaypaul6715 2 месяца назад +1

    Sir i have done step by step way but the accuracy is coming ONLY 2%

    • @SPOTLESSTECH
      @SPOTLESSTECH  2 месяца назад

      Try using my notebook from github
      And let me know if any issue

    • @gunmaypaul6715
      @gunmaypaul6715 2 месяца назад

      Sir I have tried again using the same code as provided in GitHub . It took almost 5hr for all epoch to complete the training for model. But it gave an accuracy of 0.32.

  • @e_38_sakshimulik72
    @e_38_sakshimulik72 7 месяцев назад +1

    Sir mine 1 epoch took 4 hours to complete what to do sir please help it is stuck now

  • @abhishekkaintura6398
    @abhishekkaintura6398 9 месяцев назад +1

    please upload next part soon sir

    • @SPOTLESSTECH
      @SPOTLESSTECH  9 месяцев назад +1

      Next 2 parts will be uploaded at the end of weekend
      There we will see how we can evaluate our model and most important how we can evaluate our model on some other metrics
      Like Precision, Recall, F1 score and confusion metrics of deep learning model
      Keep learning 👍👍

  • @AmrutaLandage-rx8le
    @AmrutaLandage-rx8le 6 месяцев назад +3

    My loss is more than accuracy. loss is 3. and accuracy is 0.027. Why is that so

    • @SPOTLESSTECH
      @SPOTLESSTECH  6 месяцев назад

      Model having underfitting
      Increase model size by adding layers and neurons

    • @BTECE_SHIVANANDSHRIRAME
      @BTECE_SHIVANANDSHRIRAME 6 месяцев назад

      same issue

    • @nayanchaudhary6737
      @nayanchaudhary6737 3 месяца назад

      ​@@BTECE_SHIVANANDSHRIRAMESame issue

    • @junpalencia8486
      @junpalencia8486 2 месяца назад

      @@SPOTLESSTECH I having the same issue. I tried to increase the model size 'filters=1024' but encountering "ValueError: Exception encountered when calling Conv2D.call()"

  • @ignatusanim9644
    @ignatusanim9644 6 месяцев назад +1

    tried this on different datasets and i am getting accuracy of 40-60%
    I have been thinking on how to improve it
    can anyone help?

    • @SPOTLESSTECH
      @SPOTLESSTECH  5 месяцев назад

      Check training accuracy and validation accuracy and if underfit add more layers, increase complexity of network if overfit add dropout layers decrease complexity of network

  • @BTECE_SHIVANANDSHRIRAME
    @BTECE_SHIVANANDSHRIRAME 6 месяцев назад +1

    can u share trained_model file. I am getting accuracy of 30% only

    • @SPOTLESSTECH
      @SPOTLESSTECH  6 месяцев назад

      Check playlist description

  • @hemanthjinnala5303
    @hemanthjinnala5303 7 месяцев назад +1

    ValueError: Arguments `target` and `output` must have the same rank (ndim). Received: target.shape=(None,), output.shape=(None, 38) bro please help me resolve this

    • @SPOTLESSTECH
      @SPOTLESSTECH  7 месяцев назад

      You have done something wrong in code
      See all dimensions and follow the video carefully and compare code
      I have already given all the code try to copy paste the code and debug it whats wrong in yours

    • @nishantkadlak8242
      @nishantkadlak8242 6 месяцев назад

      Check the unit size in the output dense layer

    • @fawazkhan7619
      @fawazkhan7619 6 месяцев назад

      Same error please help

  • @mayursarode9590
    @mayursarode9590 5 месяцев назад +2

    It takes 2sec/step, the accuracy i am getting is better than yours but it is time consuming, 1:30 hrs for one epoch

    • @SPOTLESSTECH
      @SPOTLESSTECH  5 месяцев назад

      Are you using GPU ?

    • @mayursarode9590
      @mayursarode9590 5 месяцев назад

      @@SPOTLESSTECH No, my laptop has great processor but integrated 8gb gpu, and i didn't use any external application to do the job.