23 lines
745 B
Python
23 lines
745 B
Python
from icrawler.builtin import BingImageCrawler
|
|
from icrawler.builtin import FlickrImageCrawler
|
|
|
|
# we are building cats image detection that's why we put cat here
|
|
# if you want some other images then put that name in classes list
|
|
classes = [
|
|
'elephant',
|
|
'elephant over the world',
|
|
'elephant in hong kong',
|
|
'elephant in china',
|
|
'elephant in england',
|
|
'elephant in us'
|
|
]
|
|
|
|
number = 999
|
|
# here root directory is find your root directory there u will find
|
|
# new file name data in which all images are saved.
|
|
|
|
for i in range(99):
|
|
for c in classes:
|
|
bing_crawler = BingImageCrawler(storage={"root_dir": f'p/elephant/{c.replace(" ",".")}'})
|
|
bing_crawler.crawl(keyword=c, filters=None, max_num=number, offset=0)
|