0:00 greetings from diazonic labs my name is
0:03 amir and welcome to my channel
0:05 when you are working on any machine
0:06 learning or deep learning or data
0:08 science project
0:09 the fundamental thing what you need is
0:11 data the most common ones are
0:13 in the form of images audio video
0:16 numbers
0:17 text etc we are today dealing with the
0:20 image data
0:21 so now the question is how do you gather
0:24 enough images
0:25 when you are training machine learning
0:27 or deep learning model
0:28 with enough amount of images watch the
0:31 video till the end to get some answer
0:34 if you haven't subscribed to our channel
0:36 please do consider subscribing it
0:38 and also press the bell icon to get the
0:40 latest notification on our videos
0:42 we bring to you lot of tech related
0:44 videos the subscribe button is given at
0:46 the bottom right corner of the video
0:49 so let's go ahead with the video as we
0:52 were discussing about the gathering of
0:54 image data
0:55 the first question to be answered is how
0:57 we can actually get the images
0:59 the most common method what we all use
1:01 to get any image is
1:03 just go to google and then download the
1:05 image and then manually annotate them
1:08 right this is what we do but then there
1:10 is another simple method simple
1:12 technique
1:13 wherein you can gather automatically
1:16 lots and lots of images
1:17 okay and this can be done with just one
1:20 help of
1:21 a simple python library and the library
1:24 which we will be using is called as
1:27 bing image downloader so you might have
1:30 definitely heard about google this is
1:32 the most
1:32 famous search engine which is available
1:35 out there
1:35 along with google we also have something
1:38 called as bing
1:39 so bing is also a search engine just
1:41 like google all right
1:43 and there is actually a python library
1:45 which is called as
1:46 bing image downloader so when you use
1:49 this particular library
1:51 it will be very easy for you to actually
1:53 scrape the data to actually download the
1:55 image data directly from the bing
1:58 website
1:59 so what i'm gonna do right now is let me
2:01 just go to say
2:03 the google chrome and i will type here
2:06 bing okay let me just go to bing here in
2:09 fact i will type bing image
2:10 all right and then if i go inside bing
2:14 images
2:15 okay so let me search for say apple
2:18 fruit here okay i'm just giving your
2:20 apple fruit and you should be able to
2:22 see
2:22 we are getting lots of apples here right
2:24 lots of apple images whatever we have
2:27 so it is just like the google search
2:29 like imagine you go to google and then
2:30 go to images and type for something you
2:32 will get it right
2:33 so what we will do is uh in our
2:36 programming language so we'll be using
2:37 the base as again python because python
2:39 is the most popular language right for
2:41 data science so we'll be using the
2:43 python language as the base and we will
2:45 install this bing image downloader
2:47 let's see how we can do that and let us
2:49 also check whether we are able to
2:50 download the images properly or not
2:52 all right so first of all i will go to
2:55 say google collab
2:56 let me just open google collab google
2:58 collab is the
3:00 online python notebook for executing
3:03 python codes so i'm just going to create
3:05 a new notebook here
3:06 now as the notebook opens uh if you
3:08 remember
3:09 whenever you are actually using any
3:12 library in python you will have to
3:14 always understand that there are two
3:16 types of libraries in python the first
3:18 one is inbuilt library
3:20 uh which is actually coming with the
3:22 interpreter whenever you download or
3:24 install any python software or go ahead
3:26 with python
3:27 interpreter online you get that
3:28 particular library as it is
3:30 and the second type is user defined
3:32 library so the user defined library is
3:34 actually handled by
3:35 one specific manager called as pip all
3:37 right so
3:38 the libraries are actually uh noted in
3:41 one specific website
3:42 called as pypi.org so what i'll do is
3:45 i'll go to this website and i will type
3:47 here
3:48 bing image downloader all right
3:51 so the documentation for this particular
3:54 wing image downloader is actually given
3:55 here
3:56 let us go inside this and you should be
3:58 able to see here it says bing image
4:00 downloader so this is a python library
4:02 to download bulk of images from bing.com
4:04 okay
4:05 uh this is what it says now how do you
4:07 install this particular library so if
4:09 you want to install this particular
4:10 library
4:11 on your say python notebook or any of
4:14 your ide
4:15 you need to just write pip install bing
4:17 image downloader all right
4:18 let us do the same here so i will copy
4:20 this
4:21 and paste it here inside my google
4:24 collab if you want to convert your
4:27 cell into say command line interface you
4:30 just need to write your exclamatory and
4:32 then let me just connect and run this
4:34 and this particular library will get
4:36 installed once the library is installed
4:39 the next thing what i'll do is
4:40 i will actually create a new directory
4:43 so for creating a new directory i can
4:44 write mkdir
4:46 make directory and let me name it as say
4:48 images
4:49 all right and let me run this as well so
4:53 it is installing the bing image
4:54 downloaded here this is installed
4:56 it is successfully installed and the
4:57 version which we are using is 1.0.4
5:00 which is the
5:00 latest version according to pypi.org as
5:04 well
5:04 it was released in july 26 2020 all
5:07 right
5:07 so once this is downloaded here i am
5:10 just creating a new folder by the name
5:12 of mkdir images
5:13 so if you see here in the file section
5:15 you should be able to see here
5:16 a new directory by the name of images is
5:19 actually available
5:20 and if you want to put this particular
5:21 thing inside the drive you can
5:22 definitely mount your drive
5:24 and do the same as well all right but
5:26 then let us continue with this
5:27 particular thing itself
5:28 now how can we download an image right
5:31 so imagine you want to download this
5:32 fruit apple fruit
5:34 image how can you do that imagine i want
5:37 to download more than
5:38 one i want to say download uh say 20 or
5:41 30 images of this
5:42 how can you do that so first of all you
5:44 need to write a simple code here
5:45 uh let me just write say from bing
5:49 underscore image underscore downloader
5:52 all right from here i will import
5:56 downloader okay this is the
5:59 library which i'm importing okay sorry
6:03 yeah so once i've imported this
6:04 particular library
6:07 from this particular package now i can
6:09 write downloader
6:11 dot download all right
6:14 and then inside this you can write what
6:17 you need to actually search so i'm
6:18 searching for apple fruit
6:20 now before continuing with the uh you
6:23 know code
6:23 i want to go back to say my pypi da
6:27 website and then inside this project
6:28 description you should be able to see
6:30 here
6:31 lot of you know queries or the
6:33 parameters which are available for this
6:34 download method
6:36 all right so the first query is query
6:37 string or this is what i have typed here
6:40 as
6:40 apple fruit and i will get that the next
6:42 thing is limit limit by default is 100
6:44 if you want uh you know you can keep it
6:47 more or you can keep it less
6:48 okay so i will give my limit i don't
6:51 want to download obviously 100 images
6:52 for now
6:53 uh so i will make it as say 10
6:56 okay just for understanding i'm gonna
6:58 make it as 10
6:59 and then the next thing is what should
7:01 be your output directory okay let me
7:03 just copy this
7:04 uh since i've already created the
7:06 directory by the name of images
7:08 i will also name the output directory as
7:11 images
7:12 all right what else do we have here here
7:14 we have got three more other parameters
7:16 which we need not use
7:17 uh but let us just discuss quickly so
7:19 the first one it says adult filter so
7:21 if you don't want any adult content then
7:23 uh you should keep it as
7:24 true okay by default it is true so i
7:26 will not make any changes here
7:28 then the next thing is force replace
7:29 imagine if you have
7:31 a folder then if that particular thing
7:33 is present then it will
7:34 delete and then it will uh start a new
7:36 download it will start a fresh download
7:38 so we don't need to do that okay let it
7:40 be false as it is and then the timeout
7:42 imagine
7:43 this particular thing is not able to get
7:44 the image properly if it is not able to
7:47 access the image it will wait for 60
7:48 seconds and then it will get the
7:50 uh timeout done then it will move on to
7:52 the next query all right this is how it
7:54 works
7:54 so we will not use this uh three
7:56 parameters okay let us just use the
7:58 first three what it is given all right
8:00 now once this is done
8:02 i will just run the code let me press
8:04 shift enter and run the code
8:05 you should be able to see here it says
8:07 indexing page one that means
8:09 the first image is actually you know
8:11 downloading here
8:12 so see here uh downloading image one
8:14 this is from the first page of bing
8:16 okay and then first image is downloaded
8:18 second image third fourth fifth sixth
8:20 seventh and ninth
8:21 okay all the ten images are now
8:23 downloaded so how can you know how can
8:25 you be sure that this particular images
8:27 are downloaded
8:28 okay so you can just go to your files
8:30 here
8:31 and then check out you should be able to
8:33 see your images
8:34 uh inside images you have got apple
8:36 fruit and then if you go inside this you
8:38 should be able to see
8:39 image one image to image three image
8:41 four all of this particular categories
8:44 or whatever the values are here uh it
8:46 will be given so let me just open it let
8:48 me just try opening this
8:49 and you should be able to see uh the
8:51 apple image opening up
8:53 all right so i'll just scroll down and
8:55 show you this is a
8:56 big picture of apple which we have got
8:59 here let me just check some other image
9:01 as well
9:02 so you should be able to see here the
9:05 apple
9:06 images are actually taken into
9:08 consideration and that is the code guys
9:10 so with the help of say barely three
9:13 lines
9:13 i have actually written a code wherein
9:16 it can download
9:17 lots of uh you know images directly
9:20 inside your say
9:21 google collab or else if you are using
9:23 any offline tool you can
9:24 directly download inside your directory
9:26 of your computer
9:28 okay this is how it does okay so if you
9:31 like this video
9:32 please do consider subscribing to our
9:34 channel let us know
9:36 if you have any queries regarding the
9:37 same