Files
004_comission/vinniesniper-54816/task1/_tools/crawer/crawler_elephant copy 2.py
louiscklaw c7fb335275 update,
2025-01-31 22:36:21 +08:00

53 lines
1.5 KiB
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",
"elephant in australia",
"elephant in brazil",
"elephant in india",
"elephant in japan",
"elephant in russia",
"elephant in south africa",
"elephant in argentina",
"elephant in mexico",
"elephant in italy",
"elephant in france",
"elephant in spain",
"elephant in germany",
"elephant in thailand",
"elephant in vietnam",
"elephant in indonesia",
"elephant in philippines",
"elephant in malaysia",
"elephant in singapore",
"elephant in egypt",
"elephant in turkey",
"elephant in greece",
"elephant in portugal",
"elephant in netherlands",
"elephant in belgium",
"elephant in sweden",
"elephant in norway",
"elephant in denmark",
"elephant in finland",
"elephant in poland",
"elephant in ukraine",
]
number = 99999
# 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)