Image Recognition & Classification with Keras in R | TensorFlow for Machine Intelligence by Google

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ • 314

  • @meshackamimo1945
    @meshackamimo1945 4 роки тому +7

    This prof made me love R..he made me understand machine learning in a very simplified way..I shall forever stay grateful

    • @bkrai
      @bkrai  4 роки тому +1

      Thanks for your nice comments!

  • @carolinemimeault3668
    @carolinemimeault3668 5 років тому +3

    Thank you Dr. Rai for the video. Very helpful. :)
    I am going back and forth to the different sections, so I thought I would add the time stamps below.
    I hope you like it and it is also helpful to others.
    Load Packages at 0:02
    Read Images at 0:29
    Explore at 4:08
    Resize at 6:16
    Reshape at 7:23
    Row Bind at 8:45
    One Hot Encoding at 11:49
    Create Model at 12:42
    Compile at 16:02
    Fit Model at 16:38
    Evaluation and Prediction (train data) at 18:49
    Evaluation and Prediction (test data) at 22:20
    True or False questions at 23:46

    • @bkrai
      @bkrai  5 років тому +2

      Thanks Caroline! I've added it to description area below this video.

  • @flamboyantperson5936
    @flamboyantperson5936 7 років тому +18

    Awesome tutorial sir, you are going deeper into R and I just love it. Please keep making videos we really need you. Thank you so much.

    • @bkrai
      @bkrai  7 років тому

      Thanks!

  • @meshackamimo1945
    @meshackamimo1945 4 роки тому +1

    There r intimidating topics like deep learning that I never wanted to touch...today,thanks to you, I am a pro.

    • @bkrai
      @bkrai  4 роки тому

      Excellent!

  • @aritrachatterjee8057
    @aritrachatterjee8057 6 років тому +8

    Nice Tutorial. Small Edit, you can read multiple files by the following command,
    pics

    • @bkrai
      @bkrai  6 років тому

      Thanks for the suggestion!

  • @liwenli7873
    @liwenli7873 4 роки тому +1

    Thank you! Wish you and your family stay well through this calamity.

    • @bkrai
      @bkrai  4 роки тому

      Thanks and best wishes to you and family too!

  • @YueHanBaoLin
    @YueHanBaoLin 5 років тому +1

    Thank you very much Dr. Rai for all the effort in creating these very helpful tutorials.

    • @bkrai
      @bkrai  5 років тому

      Thanks for your comments!

  • @victorhenostroza1871
    @victorhenostroza1871 4 роки тому +1

    Thanks for all ur effort. With this code u can get 100% accuracy Sir.
    # Compiling model
    model %>%
    keras::compile(loss = 'binary_crossentropy',
    optimizer = 'adam',
    metrics = 'accuracy')
    # Ajusting model
    history %
    fit(trainx,
    trainLabels,
    epochs = 15
    batch_size = 32,
    validation_split = 0.2)
    plot(history)

    • @bkrai
      @bkrai  4 роки тому

      Yes, it is relatively small data.

  • @InfinitesimallyInfinite
    @InfinitesimallyInfinite 6 років тому +1

    FANTASTIC! Thanks for providing such stuff for free. Really appreciate.

  • @valor36az
    @valor36az 2 роки тому +1

    Amazing tutorial. Thank you so much for making this available to us .

    • @bkrai
      @bkrai  2 роки тому

      You're very welcome!

  • @gayathri.nagarajan
    @gayathri.nagarajan 4 роки тому +1

    Sir, Iam getting an error when fitting model (16:38) " ValueError: Dimensions must be equal, but are 4 and 2 for '{{node binary_crossentropy/mul}} ". Iam using this for a data set of say 5 records . 3 training and 2 testng records where variable to be predicted is binary ( has values 0 to 4). ANy insights on which dimensions could be incorrect?

    • @bkrai
      @bkrai  4 роки тому

      If your response has values from 0 to 4, it will be incorrect to use binary. Binary is for response with only 2 values.

    • @gayathri.nagarajan
      @gayathri.nagarajan 4 роки тому +1

      Oh I see...then how do we perform model and classification for this kind sir?

    • @bkrai
      @bkrai  4 роки тому

      For more than 2 classes you can refer to this:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

    • @gayathri.nagarajan
      @gayathri.nagarajan 4 роки тому

      @@bkrai Thank you Sir..I will use this for my images and check

    • @bkrai
      @bkrai  4 роки тому

      Thanks for the update!

  • @2coolge
    @2coolge 6 років тому

    running that code "for(i in 1:12) {mypic[[i]]

    • @bkrai
      @bkrai  6 років тому

      Make sure you run library(keras) after installing keras package.

    • @2coolge
      @2coolge 6 років тому +1

      getting this error now , Error in py_module_import(module, convert = convert) :
      ModuleNotFoundError: No module named 'numpy

  • @IrinaMax
    @IrinaMax 6 років тому +2

    Thank you so much for the tutorial, very good example.

    • @bkrai
      @bkrai  6 років тому

      Thanks for comments!

  • @WahranRai
    @WahranRai 3 роки тому +1

    what about transforming the images with 3 channels into grey images : the length of flatten input is reduced and may be performance

  • @marcomichelini8444
    @marcomichelini8444 4 роки тому +1

    Awesome tutorial! But I got stuck at min 12:31 because R tells me: Error in to_categorical(testy) : could not find function "to_categorical"

    • @bkrai
      @bkrai  4 роки тому

      See if this helps:
      ua-cam.com/video/-IYYqdxdYXk/v-deo.html

  • @Felixinhk08
    @Felixinhk08 4 роки тому +2

    Thanks for the great tutorial. Can I use Keras for identifying tree species just using leaf? How do I separate the image of leaf from the background?

    • @bkrai
      @bkrai  4 роки тому +2

      Yes, you can. Note that you will have to prepare images beforehand.

    • @Felixinhk08
      @Felixinhk08 4 роки тому +1

      @@bkrai how to prepare those images using R? Is there a package that could seperate the background and the item that I want to identify? Thanks a lot.

    • @bkrai
      @bkrai  4 роки тому +1

      I'll look into it.

  • @MADHAVSHARMA-m2k
    @MADHAVSHARMA-m2k Рік тому +1

    thanku sir very good explaination ...plz make videos on NLP as well

    • @bkrai
      @bkrai  Рік тому

      For text data related videos, refer to:
      studio.ua-cam.com/users/playlistPL34t5iLfZddt0tt5GdDy3ny6X5RQvwrp6/edit

  • @sandeep3879
    @sandeep3879 4 роки тому +1

    Your videos are very informative👍, you could have used list.files and any of the apply list of functions to import multiple files

    • @bkrai
      @bkrai  4 роки тому +1

      Thanks for the suggestion! For importing multiple files you can also refer to:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @All-In-OneA1O
    @All-In-OneA1O 5 років тому

    Sir Iam getting an error while reading pics to my pic at the line for(i in 1:12){my pic[[i]]

    • @bkrai
      @bkrai  5 років тому

      Check the folder where you have pictures and make sure it only has pictures.

    • @All-In-OneA1O
      @All-In-OneA1O 5 років тому

      @@bkrai tq sir it solved ..I have not mention file format for the pic names ..tq sir

  • @jean-francoisboulet570
    @jean-francoisboulet570 3 роки тому

    Thank you Dr Rai.
    I am a beginner with treatment of image. I have a problem with array-reshape. This function stop the execution of the line. I have charge TensorFlow, Keras KerasR, reticulate. I also try using aperm without success. Could you help me ?

  • @revenez
    @revenez 6 років тому +1

    Very useful and informative, sir. Thank you!

    • @bkrai
      @bkrai  6 років тому

      Thanks for comments!

  • @fowobajek
    @fowobajek 5 років тому +2

    Excellent tutorial. Please i have issues installing EBImage package on my R 3.6.0 version. Any suggestions?

    • @bkrai
      @bkrai  5 років тому +2

      Try this:
      To install EBimage package, you can run following 2 lines;
      install.packages("BiocManager")
      BiocManager::install("EBImage")

  • @sugandhkumar3512
    @sugandhkumar3512 4 роки тому +2

    Dear Sir, Can you prepare a tutorial on the whole slide image analysis. That will be more beneficial.

    • @bkrai
      @bkrai  4 роки тому

      Thanks, I've added this to my list.

  • @theforester_
    @theforester_ 2 роки тому +1

    thanks for the tutorial! greetints from brazil

    • @bkrai
      @bkrai  2 роки тому

      You are welcome!

  • @phantasy2874
    @phantasy2874 2 роки тому

    Thanks so much, Sir. Can you make videos about using R with U-Net for semantic segmentation?

  • @hongquan9x
    @hongquan9x 2 роки тому

    Once completed with training and testing, how to predict a new image? is this corrected: model %>% predict_classes("link_newimage.jpg") ? Do we need to resize and reshape the new image before prediction? I faced several error regarding this step. i.e, Error in py_call_impl(callable, dots$args, dots$keywords)

  • @francisowino6985
    @francisowino6985 5 років тому +1

    please make a video on how to use the shiny package to develop an app for sentimental anaysis

    • @bkrai
      @bkrai  5 років тому +1

      Thanks for the suggestion, I've added it to my list.

  • @wandanoviana2949
    @wandanoviana2949 5 років тому +1

    I do not understand the section on how to create populations for cars and planes 1 through 6 and then stored in what form so that when called "setwd" runs. Please help sir,thank you...

    • @bkrai
      @bkrai  5 років тому

      See if this link helps answer your question where we read several image files:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @aingchhengngunn7431
    @aingchhengngunn7431 6 років тому +1

    Any suggestion of visualizing convolutional neural networks filter and model graph based Keras in R Studop platform?

    • @bkrai
      @bkrai  6 років тому

      Thanks for bringing this up, I'll look into this.

  • @hammao
    @hammao 5 років тому +1

    @Bharatendra Rai, you succeeded in making CNN very cool... thanks for the video. I followed the example and trust me i watch all the video several times just to get a hang of it. I feel you're the only one that has gone to lenght to explains what is actually happening in the layers. thanks for this.
    I have set of images from geology (1325 in total) belonging to 102 classes (groups). i was wondering how to handle this because physically typing the labels and dividing into test and train would take me forever. I was wondering if can recommend an easy way to handle this large data and read them in.

    • @bkrai
      @bkrai  5 років тому

      Thanks for comments!
      For reading several images you can refer to this link where all files in a folder are read easily:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @riyahedaoo2753
    @riyahedaoo2753 3 роки тому +1

    Sir, why did you used 28 for resizing ? What other sizescan be used for best result? On what basis do we choose the size?

    • @bkrai
      @bkrai  3 роки тому +1

      Since this is just for illustration, I used small size so that it runs faster. But there is no such requirement, you can use any other size.

    • @riyahedaoo2753
      @riyahedaoo2753 3 роки тому +1

      @@bkrai Okay Thanks!

  • @MD-ub9nt
    @MD-ub9nt 5 років тому +1

    thank you for your tutorial. It works perfectly, however, when I increase the resolution of the pictures you provided (50x50, 75x75, etc...) it doesnt seem to work. I have changes the resolution in both resize and reshape. When I use resolution similar to the one you provided (29x29 or 27x27) it does seem to work (it says the accurary is 0.5, flipping a coin, esencially). How is this possible?

    • @bkrai
      @bkrai  5 років тому

      Make sure training data do not have same type of images in a sequence.

  • @sharangowdapatil8453
    @sharangowdapatil8453 6 років тому +2

    When I try to use *array_reshape* in
    # Reshape
    for (i in 1:12) {mypic[[i]]

    • @bkrai
      @bkrai  6 років тому +1

      Thanks for the update!

    • @sharangowdapatil8453
      @sharangowdapatil8453 6 років тому +1

      Bharatendra Rai
      I should thank you for your videos

    • @sonujack1
      @sonujack1 6 років тому

      i am getting the following error.. please help
      ERROR: dependencies 'jsonlite', 'reticulate' are not available for package 'tensorflow'
      * removing 'C:/Users/dell/Documents/R/win-library/3.5/tensorflow'
      In R CMD INSTALL
      Installation failed: Command failed (1)

  • @faceprofesor
    @faceprofesor 3 роки тому +1

    Awesome !!! Can this be used to discern between two types of fish?

    • @bkrai
      @bkrai  3 роки тому +1

      Yes, definitely

  • @cosimotuena6597
    @cosimotuena6597 5 років тому +1

    Dear Dr Rai
    Many thanks this is very helpful. However if when I tried to replicate your example I get error for the history object and consequently on the "evaluation and prediction" because there is an issue with py_call_impl(callable, dots$args, dors$keywords): input arrays should have the same number of samples as target arrays. Found 5 input samples and 10 target samples.
    Any cues to solve this?
    Thanks!

    • @bkrai
      @bkrai  5 років тому

      There is a mismatch between target values (10 data points) and input (5 data points).

    • @cosimotuena6597
      @cosimotuena6597 5 років тому

      Many thanks! I solved and I managed to run the script however sometimes I ve got issue with 1 0 coding. If I check the predicted actual matrix I gives me, apparently randomly, only one row(ie accuracy is 50% cause predict only one class). Any clues? Best Regards!

  • @adarmawan5393
    @adarmawan5393 2 роки тому +1

    Awesome tutorial Dr. Rai. Thank you. It was inspire me a lot. Today I have tried to follow, but I am still facing problem --> Error: Python module tensorflow.keras was not found. I have try to re-install tensorflow and karas, but still same.

    • @bkrai
      @bkrai  2 роки тому

      If you are using Mac, try this:
      ua-cam.com/video/-IYYqdxdYXk/v-deo.html

  • @jozefsavel730
    @jozefsavel730 6 років тому

    Hi is there any possibility to use more than just one variable as output in this or other NN packages?

  • @theREstd
    @theREstd 7 років тому +1

    Hello Sir,
    Its a really nice tutorial. Can you please tell me what do we do for a multiple image classification problem??
    Thanks

    • @bkrai
      @bkrai  6 років тому

      This tutorial is for one image in a picture only.

  • @mymessage11
    @mymessage11 4 роки тому +1

    Thank you .
    Btw, If we have for example more than 12 pictures, ( consider 5000), then how we can assign them in pics?
    pics

    • @bkrai
      @bkrai  4 роки тому

      You can refer to this for reading any number of image files from a folder:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @BogdanAnastasiei
    @BogdanAnastasiei 4 роки тому +1

    Does mypic need to be a list? Can we define it as a data frame as well? Thanks.

    • @bkrai
      @bkrai  4 роки тому +1

      I've not tried, but see if it works.

  • @ekwallace10
    @ekwallace10 4 роки тому +1

    Thank you so much for a great tutorial! I am currently working with a large dataset of images (around 30,000 images). How could I make a list like you did under 'pics' easily without listing all of the filenames? Thank you!

    • @bkrai
      @bkrai  4 роки тому +3

      You can find an example here:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @sahingurol7510
    @sahingurol7510 6 років тому +1

    Hi Rai
    Can you also make a video about h2o package.. espacially for the automl function.. and share your comments about if it is succesfull or not

    • @bkrai
      @bkrai  6 років тому

      Thanks for the suggestion! I have added it to my list.

  • @RahulKumar-ld1io
    @RahulKumar-ld1io 5 років тому +1

    Sir, after the command
    trainLabels

    • @bkrai
      @bkrai  4 роки тому

      I don't see any error in this specific line. Probably error is somewhere earlier and the effect is seen here.

  • @BogdanAnastasiei
    @BogdanAnastasiei 4 роки тому +1

    Hello... I'm back with a serious problem. I cannot use the array_reshape function. First, I had to install the retculate package, because the program told me that this function is part of the reticulate package, not keras (??). But even after installing reticulate, I got the following error for when executed the array_reshape function:
    Error in py_call_impl(callable, dots$args, dots$keywords) :
    Evaluation error: Required version of NumPy not available: numpy.core.multiarray failed to import.
    What could that be? Thank you very much!

    • @bkrai
      @bkrai  4 роки тому

      Probably try this:
      ua-cam.com/video/-IYYqdxdYXk/v-deo.html

  • @ashishkamboj009
    @ashishkamboj009 6 років тому

    I'm getting below error while reading the images-
    Error in readJPEG(x, ...) :
    JPEG decompression error: Not a JPEG file: starts with 0x89 0x50
    As I have all the images in JPEG format but when I used the image_read() function from the magick package, I found that some of the images having PNG format.
    So, How to find all those images where there is a change in extension? Also, how to convert these type of images in pixel format?

  • @gayathri.nagarajan
    @gayathri.nagarajan 4 роки тому +1

    to_categorical is throwing an error for me "Error in install_tensorflow() :
    could not find function "install_tensorflow". Can you let me know how to proceed ?

    • @bkrai
      @bkrai  4 роки тому

      You can try this:
      ua-cam.com/video/-IYYqdxdYXk/v-deo.html

  • @njbuitragoa
    @njbuitragoa 6 років тому

    Professor Bharatendra, I would like to inquire you how can I put another kind of metric, namely, log loss function or another one. This is due to metrics=c("categorical_accuracy") is not working very well and it seems that I obtained for a multiclass problem an imbalanced classes problem for a set of images with the same quantity of elements for each class. Thank you in advance for your answer.

    • @bkrai
      @bkrai  6 років тому

      Did you try: metrics = c('accuracy')

  • @statisticalworld1133
    @statisticalworld1133 5 років тому +1

    Good job. Really Appreciated.

    • @bkrai
      @bkrai  5 років тому

      Thanks for comments!

  • @Abhishek-wp9xu
    @Abhishek-wp9xu 5 років тому +1

    sir while executing to_categorial function of keras library i am getting error as pythan module keras not found. but i have installed keras library in R already. so plz give me solution over it.

    • @bkrai
      @bkrai  5 років тому

      Make sure after installing you also run the library line.

  • @saimohan4717
    @saimohan4717 5 років тому +1

    Sir, after the command
    trainLabels

    • @bkrai
      @bkrai  5 років тому

      I would suggest to download and install 64bit version of R.

  • @bulletkip
    @bulletkip 5 років тому +1

    another great tutorial, thank you.

    • @bkrai
      @bkrai  5 років тому

      Thanks for comments!

  • @MD-ub9nt
    @MD-ub9nt 4 роки тому

    excellet tutorial. I was wondering how can you make a class activation map (heatmap) from the tutorial you just made.

  • @김수민-c4j4m
    @김수민-c4j4m 2 місяці тому

    Hi. first of all, than kyou for making this video. While I was following the steps, mine keep making error when doing "Reshape". It says 'dll load failed'. I thought there was a problem with keras, so I re-installed it thousand times and it never works. please help me...I have no time for my work...I'm hoping your fast respond. Thank you

  • @kmonica2113
    @kmonica2113 4 роки тому +2

    Can I know which model is used

    • @bkrai
      @bkrai  4 роки тому

      It's MLP.

    • @kmonica2113
      @kmonica2113 4 роки тому +1

      @@bkrai tqs ,sir what if there are 4 different images to classify then how to label with binary values

    • @bkrai
      @bkrai  4 роки тому

      This link has 10 different images:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @krissawoodring1750
    @krissawoodring1750 5 років тому +1

    Great tutorial.. but having a lot of issues with memory. After trying to train the model I get 'Error in py_call_impl(callable, dots$args, dots$keywords): ResourceExhaustedError: OOM when allocating tensor...' Anyone else have this issue or know how to solve it?

    • @bkrai
      @bkrai  5 років тому

      If you already have any data or similar file open that you are not using, I would suggest close it and try again.

  • @arzumkizilelma3150
    @arzumkizilelma3150 4 роки тому +1

    what can i use as a binary_crossentropy? I have 4 response variables. It's urgent please help.

    • @bkrai
      @bkrai  4 роки тому

      categorical_crossentropy()

    • @bkrai
      @bkrai  4 роки тому

      You can also refer to this:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @All-In-OneA1O
    @All-In-OneA1O 5 років тому +2

    Sir Iam getting the error at encoding that is Error in to_categorical(trainy):could not find function to_categorical

    • @bkrai
      @bkrai  5 років тому

      Make sure you have run library(keras).

    • @All-In-OneA1O
      @All-In-OneA1O 5 років тому

      @@bkrai sir I have runned keras in separate sessionR also,but it again showing Python.keras not found nd sometime it showing to_categorical function not found

    • @bkrai
      @bkrai  5 років тому

      That means keras is not installed.

    • @All-In-OneA1O
      @All-In-OneA1O 5 років тому

      @@bkrai k tq sir..I want small information sir..is there any package to open our webcam?.how to take pics and then compare it in r language ..

  • @stefanus_christian
    @stefanus_christian 6 років тому +1

    Thankyou so much for the tutorial. It really help me understand about Keras in R. But, while i'm trying to practicing the code, i got an error on fit model. The error is " Error in py_call_impl(callable, dots$args, dots$keywords) :
    ValueError: Error when checking target: expected dense_3 to have shape (2,) but got array with shape (1,)" can you help me to understand the problem? Thanyou so much!

    • @bkrai
      @bkrai  6 років тому

      I saw your message now. I hope by now you figured it out.

  • @tulsipatro4662
    @tulsipatro4662 4 роки тому +2

    Sir..I am getting an error in the function "to_categorical" saying that it could not find the function

    • @BilalHussain-md2ch
      @BilalHussain-md2ch 4 роки тому +2

      Try this, worked for me. :)
      -- Install these:
      install.packages("BiocManager")
      BiocManager::install("EBImage") #EBImage isn't supported in latest R, so this...
      install.packages("keras")
      install.packages("tensorflow")
      library("EBImage")
      library("keras")
      library("tensorflow")
      install_tensorflow() #install for to_categorical()
      -- After installation is complete, it shows restarting session and gets stuck there... Manually restart RStudio, load those three libraries and run the rest of the code.
      Also, alternatives to to_categorical:
      Package CatEncoders, OneHotEncoder (same as Python scikit-learn).
      Package caret, function dummyVars.

    • @bkrai
      @bkrai  4 роки тому +1

      Thanks for the update!

    • @Felixinhk08
      @Felixinhk08 4 роки тому

      @@BilalHussain-md2ch I have tried your method but it still doesn't work:
      Error: Python module tensorflow.keras was not found.
      Detected Python configuration:
      python: C:/Users/b145065/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
      libpython: C:/Users/b145065/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
      pythonhome: C:/Users/b145065/AppData/Local/r-miniconda/envs/r-reticulate
      version: 3.6.12 |Anaconda, Inc.| (default, Sep 9 2020, 00:29:25) [MSC v.1916 64 bit (AMD64)]
      Architecture: 64bit
      numpy: C:/Users/b145065/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
      numpy_version: 1.19.1

    • @robertt396
      @robertt396 4 роки тому

      @@Felixinhk08 You need to run this line and then restart R, then take the line out and try it :) :
      install_tensorflow()

  • @CK-vy2qv
    @CK-vy2qv 5 років тому +3

    Well, EBImage is not available anymore so .. :/

    • @bkrai
      @bkrai  5 років тому +1

      Codes for installing EBImage should be there in the description area.

    • @CK-vy2qv
      @CK-vy2qv 5 років тому +2

      @@bkrai You are correct. It worked great, much appreciated Dr Rai!

    • @bkrai
      @bkrai  5 років тому

      Thanks for the update!

  • @renjiisac2305
    @renjiisac2305 6 років тому +1

    When I try using #Reshape
    I get this error: Error in initialize_python(required_module, use_environment) :
    Installation of Python not found, Python bindings not loaded.

    • @drgones545
      @drgones545 5 років тому

      you must be install Anaconda and run rstudio form there. Check this link :github.com/rstudio/keras/issues/649

  • @ollycizilio1651
    @ollycizilio1651 5 років тому

    Error in py_call_impl(callable, dots$args, dots$keywords) :
    ValueError: A target array with shape (10, 1) was passed for an output of shape (None, 2) while using as loss `binary_crossentropy`. This loss expects targets to have the same shape as the output

  • @Felixinhk08
    @Felixinhk08 4 роки тому +1

    Instead of using binary, I got multiple categories, which loss function should I use?

    • @bkrai
      @bkrai  4 роки тому +1

      You can refer to this where we have 10 categories:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

  • @BogdanAnastasiei
    @BogdanAnastasiei 4 роки тому +1

    Unfortunately, it does not work. The keras_model_sequential function does not work. It gives an error: the module keras.tensorflow was not found. I have tried everything: the functions install_keras(), instal_tensorflow() and so on - no result. Please tell me, there are some technical conditions that you don't specify in the video? Do you need to have installed Anaconda, Python?... Which versions? I have installed Anaconda, tried to activate the environment etc. etc. but useless. it seems that I cannot make keras work on my machine. Could someone help? Thanks.

    • @bkrai
      @bkrai  4 роки тому

      Check this link:
      ua-cam.com/video/-IYYqdxdYXk/v-deo.html

  • @me3jab1
    @me3jab1 4 роки тому +1

    Sir , PLease I have one question : deep Learning Process in r I mean if you want to case study whats it the process , step by step

    • @bkrai
      @bkrai  4 роки тому +1

      You can find some case studies here:
      ua-cam.com/play/PL34t5iLfZddtC6LqEfalIBhQGSZX77bOn.html

    • @me3jab1
      @me3jab1 4 роки тому +1

      @@bkrai yes I already followed your videos as I understand :
      1-Load Data.
      2-Define Keras Model.
      3-Compile Keras Model.
      4-Fit Keras Model.
      5-Evaluate Keras Model.
      6-Tie It All Together.
      7-Make Predictions

    • @bkrai
      @bkrai  4 роки тому +1

      Perfect!

  • @Felixinhk08
    @Felixinhk08 4 роки тому +1

    I don't understand why the batch size is 32? What does it mean?

    • @bkrai
      @bkrai  4 роки тому

      Here the data is too small. If the batch size specified is larger than the data size, essentially all samples in the data will be used.

  • @biswarana4491
    @biswarana4491 5 років тому +1

    i am facing trouble loading tensorflow
    any suggestions

  • @flamboyantperson5936
    @flamboyantperson5936 7 років тому +1

    Sir I have a request please do a video on Naive Bayes classifier on any data and please also teach little theory before the video so we can understand it and explain it to others. Thank you sir.

    • @bkrai
      @bkrai  7 років тому

      Thanks, it's on my list and I'll try to do it soon.

    • @flamboyantperson5936
      @flamboyantperson5936 7 років тому +1

      Thank you Sir

  • @maddy14390
    @maddy14390 6 років тому +1

    how can this code be modified to classify more than 2 categories of images? Like, I have 6 classes of images and need to classify any new image to be among any 1 of the 6 categories.
    Also, I am not able to use the keras package as it is showing me "Error: Python module keras was not found." whereas I have it installed in my python environment.
    Can you help me in this as i need to understand this code and work on my thesis?
    Thankyou

    • @bkrai
      @bkrai  6 років тому

      You can try this link:
      ua-cam.com/video/LxTDLEdetmI/v-deo.html

    • @bkrai
      @bkrai  6 років тому

      In addition for more complete coverage, you can use following playlist:
      ua-cam.com/play/PL34t5iLfZddtC6LqEfalIBhQGSZX77bOn.html

    • @maddy14390
      @maddy14390 6 років тому +1

      Thank you Sir. Glad to study through your videos. Neural networks look like a piece of cake now.

    • @bkrai
      @bkrai  6 років тому

      Thanks for your comments!

  • @chriss7771
    @chriss7771 6 років тому

    Any idea why I am getting Error in transpose(y) : object is NULL when running for loop readImage(pics[i])

    • @Abhishek-wp9xu
      @Abhishek-wp9xu 5 років тому

      either u have not installed EBimage package or just execute library(EBimage) line before executing for loop.

  • @shivadarshans3409
    @shivadarshans3409 4 роки тому +1

    Hii sir.
    I understood everything u said in this vedio thank u nice vedio sir
    But how can we update this for multi class image classification
    Once again thank u

    • @bkrai
      @bkrai  4 роки тому

      You can refer to this link for multi class:
      ua-cam.com/video/5bso_5X7Zu4/v-deo.html

    • @shivadarshans3409
      @shivadarshans3409 4 роки тому +1

      @@bkrai thank u sir

    • @bkrai
      @bkrai  4 роки тому

      Welcome!

  • @selvavigneshm6266
    @selvavigneshm6266 4 роки тому +1

    Sir the EBImage package is not coming for version 3.6..pls help me

    • @bkrai
      @bkrai  4 роки тому

      To install EBimage package, you can run following 2 lines;
      install.packages("BiocManager")
      BiocManager::install("EBImage")

  • @irfanshaik2301
    @irfanshaik2301 6 років тому

    Hii sir,
    display(mypic[[1]])
    Error in UseMethod("display", x) :
    no applicable method for 'display' applied to an object of class "c('Image', 'array', 'structure', 'vector')"

    • @bkrai
      @bkrai  6 років тому

      check if you ran EBImage library or not

  • @bankingnews862
    @bankingnews862 6 років тому

    Can u tell the code to read thousands of images using EBImage package instead of importing one by one? Thanks in advance sir.

  • @hapvideolar7957
    @hapvideolar7957 2 роки тому

    Thanx for share Sir,
    I am getting
    "Error in unique.default(x, nmax = nmax) :
    unique() applies only to vectors
    "
    What could be a solution for me sir?

    • @uchekalu7725
      @uchekalu7725 2 роки тому +2

      Use pipe operator to add as.numeric() to k_argmax
      As in
      k_argmax %>% as.numeric()

    • @hapvideolar7957
      @hapvideolar7957 2 роки тому

      @@uchekalu7725 Hello, thanks for help. Here is my related code:
      "
      #evaluation & prediction -traindata
      model %>% evaluate(trainx, trainLabels)
      pred % predict(trainx) %>% k_argmax() #pred % predict(trainx)
      pred
      table(Predicted = pred, Actual = trainy)
      prob % predict(trainx)#prob % predict_proba(trainx) #prob % predict()
      prob
      cbind(prob, Prected = pred, Actual= trainy)
      " could you write the correct code?

    • @uchekalu7725
      @uchekalu7725 2 роки тому +2

      @@hapvideolar7957
      #Evaluation: model %>% evaluate(trainx, trainLabels)
      #Prediction: pred % predict(trainx) %>% k_argmax() %>% as.numeric()
      #ConfusionMatrix: table(Predicted = pred, Actual = trainy)
      prob % predict(trainx)
      cbind(prob, Predicted = pred, Actual = trainy)
      Hope this helps.

    • @hapvideolar7957
      @hapvideolar7957 2 роки тому

      @@uchekalu7725 yes, thx. I had already solved thx 2 u that day you replied first.

    • @hapvideolar7957
      @hapvideolar7957 2 роки тому

      It works out

  • @joeltharian
    @joeltharian 6 років тому

    @bharatendra rai sir, I am getting an error: > history %
    + fit(trainx,
    + trainLabels,
    + epochs = 30,
    + batch_size = 32,
    + validation_split = 0.2)
    Error in py_call_impl(callable, dots$args, dots$keywords) :
    ValueError: Input arrays should have the same number of samples as target arrays. Found 5 input samples and 10 target samples.

    • @bkrai
      @bkrai  6 років тому

      It says "Found 5 input samples and 10 target samples." Make sure to use proper number of units.

    • @joeltharian
      @joeltharian 6 років тому

      @@bkrai proper number of units where exactly sir?

    • @bkrai
      @bkrai  6 років тому

      What codes have you used under # Model and # Compile?

    • @joeltharian
      @joeltharian 6 років тому

      @@bkrai # Model
      model %
      layer_dense(units = 256, activation = "relu", input_shape = c(2352)) %>%
      layer_dense(units = 128, activation = 'relu') %>%
      layer_dense(units = 2, activation = "softmax")
      summary(model)
      # Compile
      model %>%
      compile(loss = "binary_crossentropy",
      optimizer = optimizer_rmsprop(),
      metrics = c('accuracy'))

    • @bkrai
      @bkrai  6 років тому

      This also looks right.
      Next I would suggest check line-27 from the video. Note that first I read 1 to 5 pictures and then from 7 to 11. This way there were totally "10 input samples".

  • @vjysri2756
    @vjysri2756 5 років тому +1

    I would like to train images against matrices as respponse variables, can you please help with the code

    • @bkrai
      @bkrai  4 роки тому

      What kind of matrices are these?

    • @vjysri2756
      @vjysri2756 4 роки тому

      A matrix containing single row and 6 columns.

    • @vjysri2756
      @vjysri2756 4 роки тому

      Or can we train matirx against another matrix with both matrices containing [1 row * 6 columns]. Thanks

  • @MAbdullah47
    @MAbdullah47 6 років тому +1

    Thank you, sir, for this video I did it based on your code but it gives me 50% accuracy with exactly the same code you post in the video, how this coming? how can we re-modify the model to reach the best accuracy?

    • @woutertwo
      @woutertwo 6 років тому +2

      Use [sigmoid] instead of [softmax] in output layer. Worked for me.

    • @99chintu
      @99chintu 6 років тому

      @@woutertwo thanks sigmoid worked for me

  • @cinderellameilani6261
    @cinderellameilani6261 5 років тому +1

    i've problem with tensorflow, how to install tensorflow in R on macbook? Thank you sir

    • @bkrai
      @bkrai  5 років тому

      You can use following code:
      install.packages("tensorflow")
      library(tensorflow)
      install_tensorflow()

  • @coolghoul9
    @coolghoul9 9 місяців тому +1

    any chance of updated version of this

    • @bkrai
      @bkrai  9 місяців тому

      I'm exploring updating this and other deep learning videos. Hopefully I'll be able to start later this month.

  • @hamadsaeed1481
    @hamadsaeed1481 6 років тому

    I got a problem with array_reshape, it tell me getting error Error in initialize_python(required_module, use_environment) :
    Installation of Python not found, Python bindings not loaded.
    I run keras and I run EBImage but the problem is still there
    im trying to reach you and send you my codes, but I couldn't find ur contact.

    • @bkrai
      @bkrai  6 років тому

      Probably issue with keras installation. Try this link before image recognition video:
      ua-cam.com/video/hd81EH1g1bE/v-deo.html

  • @Mohib283
    @Mohib283 7 років тому

    when i use: trainLabels

    • @bkrai
      @bkrai  7 років тому

      keras package that I used in the video is version 2.1.2. The one you installed is version 1.2.0 which is too old. I would suggest you install it again.

  • @IntanMarliah
    @IntanMarliah 8 місяців тому

    Hallo, why does my trainLabels just error?

  • @venustat
    @venustat 7 років тому +1

    Good One..
    trainLabels< to_categorical(trainy)
    Error: object 'trainLabels' not found.. How to solve this

    • @bkrai
      @bkrai  7 років тому +1

      It should be:

    • @venustat
      @venustat 7 років тому

      Yes thanks so much

  • @sonalikapanda8398
    @sonalikapanda8398 7 років тому +1

    Hello Sir.EBImage Package is not getting installed for 3.4.3R Version.Kindly suggest.

    • @bkrai
      @bkrai  7 років тому

      If you not installed EBImage package yet, then you can make use of following link:
      ua-cam.com/video/dKgEDAUUtoo/v-deo.html

    • @muditsingh4468
      @muditsingh4468 7 років тому

      use this code:
      source("bioconductor.org/biocLite.R")
      biocLite()
      biocLite(c("GenomicFeatures", "AnnotationDbi"))
      biocLite("EBImage")
      library(EBImage)

  • @Yadofficial
    @Yadofficial 5 років тому +1

    Sir i am get an error
    Error: object 'trainLabels' not found

    • @bkrai
      @bkrai  5 років тому

      Probably you missed running a previous line

  • @kaustubhp5258
    @kaustubhp5258 7 місяців тому

    How to proceed after following code and error?
    #R code line:
    trainLabels

    • @Alexdarkkiller2
      @Alexdarkkiller2 7 місяців тому

      It is really a pain to get tensorflow running on rstudio. First you have to install tensorflow on anaconda (there guides for it on youtube) and then on rstudio. (that worked for me)

  • @ubelyildmar2368
    @ubelyildmar2368 4 роки тому

    Awesome video, Thank you. I still cannot install EBImage :(
    Package which is only available in source form, and may need
    compilation of C/C++/Fortran: ‘EBImage’

    • @bkrai
      @bkrai  4 роки тому +2

      To install EBimage package, you can run following 2 lines;
      install.packages("BiocManager")
      BiocManager::install("EBImage")

    • @ubelyildmar2368
      @ubelyildmar2368 4 роки тому

      @@bkrai thank you so much. These two lines gave me the error above.

  • @badrinathkrish4661
    @badrinathkrish4661 6 років тому

    need help I cannot run the library keras and EbImage.... Is there any other requirements for this?

    • @bkrai
      @bkrai  6 років тому

      For installing keras, refer to this link:
      ua-cam.com/video/hd81EH1g1bE/v-deo.html

  • @LivingOnAllah
    @LivingOnAllah 6 років тому

    when i run the code, the following error occur.
    > model %>%
    + layer_dense(units = 256, activation = 'relu', input_shape = c(2352)) %>%
    +
    + layer_dense(units = 128, activation = 'relu') %>%
    +
    + layer_dense(units = 2, activation = 'softmax')
    Error in eval(lhs, parent, parent) : object 'model' not found
    > summary(model)
    Error in summary(model) : object 'model' not found
    can you help me?

    • @99chintu
      @99chintu 6 років тому

      have you declared the model object i.e model

  • @fafeabo8681
    @fafeabo8681 6 років тому +1

    Thank you very much it is a good tutorial

    • @bkrai
      @bkrai  6 років тому

      Thanks for comments!

  • @ankurpatel1809
    @ankurpatel1809 5 років тому +2

    can i resize the images without naming them manually? i need to resize 400 images)

    • @bkrai
      @bkrai  5 років тому

      This link provides steps to read any number of images from a directory.

  • @vipinsharma2461
    @vipinsharma2461 6 років тому

    hi I am getting the following error. kindly suggest the solution> pred % predict_classes(trainx)
    Error in py_call_impl(callable, dots$args, dots$keywords) :
    TypeError: float() argument must be a string or a number, not 'NoneType'

    • @bkrai
      @bkrai  6 років тому

      This code refers to line 62. Check earlier lines to make sure there are no errors.

    • @vipinsharma2461
      @vipinsharma2461 6 років тому

      No error prior to this line. Shall I reinstall keras ?

  • @muhammadaqil5432
    @muhammadaqil5432 2 роки тому

    i have just follow your tutrial amd retrain your data but i got error on fitting model...as follows
    Error in py_call_impl(callable, dots$args, dots$keywords) :
    ValueError: in user code:
    File "C:\Users\LENOVO\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\keras\engine\training.py", line 1021, in train_function *
    return step_function(self, iterator)
    please help me to complete my trial...thanks

  • @ajaysingh-gj2eo
    @ajaysingh-gj2eo 5 років тому +1

    Sir I want to know more about binary_ cross entropy??

    • @bkrai
      @bkrai  5 років тому

      Try this for a good explanation: goo.gl/8CeqaR

  • @netmarketer77
    @netmarketer77 4 роки тому +1

    Can I use Keras for Facial Recognition?

    • @bkrai
      @bkrai  4 роки тому +1

      Yes and CNN is the best method to use.

  • @foot94able
    @foot94able 5 років тому +1

    What type of machine learning classification is this please?

    • @bkrai
      @bkrai  5 років тому

      It uses neural networks.

  • @GautamKumar-qi3jv
    @GautamKumar-qi3jv 6 років тому +1

    I have used your dataset and your code but still it gives me 0.5 accuracy... any idea why?

    • @bkrai
      @bkrai  6 років тому

      You can try running it again.

    • @GautamKumar-qi3jv
      @GautamKumar-qi3jv 6 років тому

      Bharatendra Rai I did try for around 5 times....Each time the same result...After that I left it alone..

    • @bkrai
      @bkrai  6 років тому

      Probably some minor issue in the code.

    • @sergioteixeira9405
      @sergioteixeira9405 6 років тому

      Dear Mr Bharatendra, thank you for the awesome video! I am getting the same results of Mr Kumar thought... I tried to review the code but was unable to find any mistakes. The model always predicts car!
      Actual
      Predicted 0 1
      0 5 5
      the histogram does not display an initial variation in the training and a posterior stabilization. The plot is stable in the same probability since the beginning!? Can you offer some insights in what is happening? I had some problems installing​ EBImage in the 3.5 R.

    • @bkrai
      @bkrai  6 років тому

      Send me your code to look at.

  • @rbssandmaster
    @rbssandmaster 6 років тому +1

    how to use tensorflow has a backend i m getting please help me out

    • @bkrai
      @bkrai  6 років тому

      Once you install Keras, tensorflow will automatically be used as backend.

    • @arnavverma3557
      @arnavverma3557 5 років тому

      hi Sir, thanks for very great video.I am getting error for the line number 34 & 35trainLabels

  • @jodiewarren
    @jodiewarren 4 роки тому +1

    Hello, first of all thank you for making this tutorial! I am very new to R and machine learning, and this tutorial has really helped me to understand each of the steps. I am however coming up against an error regarding the input, and wondered if you had and suggestions?
    when I use:
    history %
    fit(trainx,
    trainLabels,
    epochs = 30,
    batch_size = 32,
    validation_split = 0.2)
    I get this error:
    ValueError: Input 0 of layer sequential_10 is incompatible with the layer: expected axis -1 of input shape to have value 2352 but received input with shape [None, 20, 1]
    *'sequential_10' is the name of the model in Kaggle I believe
    For some reason I wasn't able to get tensorflow to work in R on my laptop (despite trying lots of different methods for 2 weeks), and so I am using a combination of R and a Kaggle Notebook using R script. I am doing the first steps (importing images, reshaping, binding) in R, then exporting 'trainx' and 'testx' as csv files, then loading those into Kaggle... is this where I am going wrong? I am using planes vs cars images, and I don't see any errors in the previous lines of code. Searching this error online hasn't proved to solve the situation yet either

    • @bkrai
      @bkrai  4 роки тому

      The main issue is "expected input shape to have value 2352 but received input with shape [None, 20, 1]"
      You need to fix this.

    • @jodiewarren
      @jodiewarren 4 роки тому +1

      @@bkrai Hi, I have solved this, thank you!

    • @bkrai
      @bkrai  4 роки тому

      Thanks for the update!

    • @jodiewarren
      @jodiewarren 3 роки тому

      @@bkrai Hello again! Would you please be able to tell me if this is a feedforward or feedback/recurrent NN?