update,
This commit is contained in:
11
vinniesniper-54816/task1/_lab/003-crawler/crawler.py
Normal file
11
vinniesniper-54816/task1/_lab/003-crawler/crawler.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from icrawler.builtin import BingImageCrawler
|
||||
|
||||
# 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", "horse", "mountain"]
|
||||
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 c in classes:
|
||||
bing_crawler = BingImageCrawler(storage={"root_dir": f'p/{c.replace(" ",".")}'})
|
||||
bing_crawler.crawl(keyword=c, filters=None, max_num=number, offset=0)
|
@@ -0,0 +1,11 @@
|
||||
from icrawler.builtin import BingImageCrawler
|
||||
|
||||
# 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"]
|
||||
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 c in classes:
|
||||
bing_crawler = BingImageCrawler(storage={"root_dir": f'p/{c.replace(" ",".")}'})
|
||||
bing_crawler.crawl(keyword=c, filters=None, max_num=number, offset=0)
|
@@ -0,0 +1,11 @@
|
||||
from icrawler.builtin import BingImageCrawler
|
||||
|
||||
# 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 = ["horse image with white background"]
|
||||
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 c in classes:
|
||||
bing_crawler = BingImageCrawler(storage={"root_dir": f'p/{c.replace(" ",".")}'})
|
||||
bing_crawler.crawl(keyword=c, filters=None, max_num=number, offset=0)
|
36
vinniesniper-54816/task1/_lab/003-crawler/crawler_horse.py
Normal file
36
vinniesniper-54816/task1/_lab/003-crawler/crawler_horse.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from icrawler.builtin import BingImageCrawler
|
||||
from icrawler.builtin import GoogleImageCrawler
|
||||
|
||||
# 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 = [
|
||||
"horse standing in white background",
|
||||
"horse running in white background",
|
||||
"horse sleeping in white background",
|
||||
"horse eating in white background",
|
||||
"horse shitting in white background",
|
||||
"horse sitting in white background",
|
||||
"horse racing in white background",
|
||||
"horse head in white background",
|
||||
"horse body in white background",
|
||||
"horse legs in white background",
|
||||
"horse ears in white background",
|
||||
"horse eyes in white background",
|
||||
"horse tail in white background",
|
||||
"any horse in white background",
|
||||
]
|
||||
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 c in classes:
|
||||
# bing_crawler = BingImageCrawler(storage={"root_dir": f'p/{c.replace(" ",".")}'})
|
||||
# bing_crawler.crawl(keyword=c, filters=None, max_num=number, offset=0)
|
||||
|
||||
google_crawler = GoogleImageCrawler(storage={"root_dir": f'p/{c.replace(" ",".")}'})
|
||||
google_crawler.crawl(
|
||||
keyword=c,
|
||||
offset=0,
|
||||
max_num=99999,
|
||||
min_size=(50, 50),
|
||||
max_size=None,
|
||||
)
|
@@ -0,0 +1,11 @@
|
||||
from icrawler.builtin import BingImageCrawler
|
||||
|
||||
# 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 = ["mountain"]
|
||||
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 c in classes:
|
||||
bing_crawler = BingImageCrawler(storage={"root_dir": f'p/{c.replace(" ",".")}'})
|
||||
bing_crawler.crawl(keyword=c, filters=None, max_num=number, offset=0)
|
9
vinniesniper-54816/task1/_lab/003-crawler/crawler_n.py
Normal file
9
vinniesniper-54816/task1/_lab/003-crawler/crawler_n.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from icrawler.builtin import BingImageCrawler
|
||||
|
||||
classes = ["bus", "flowers", "Human faces"]
|
||||
number = 100
|
||||
|
||||
for c in classes:
|
||||
# see n is represent negaive images
|
||||
bing_crawler = BingImageCrawler(storage={"root_dir": f'n/{c.replace(" ",".")}'})
|
||||
bing_crawler.crawl(keyword=c, filters=None, max_num=number, offset=0)
|
6
vinniesniper-54816/task1/_lab/003-crawler/import_horse.sh
Executable file
6
vinniesniper-54816/task1/_lab/003-crawler/import_horse.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
cp /home/logic/_wsl_workspace/comission-playlist-2024/vinniesniper-54816-src/task1/_lab/003-crawler/output/*.jpg \
|
||||
/home/logic/.keras/datasets/flower_photos/7xx_Horse
|
16
vinniesniper-54816/task1/_lab/003-crawler/merge.py
Normal file
16
vinniesniper-54816/task1/_lab/003-crawler/merge.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def merge_images(input_folder, output_folder):
|
||||
if not os.path.exists(output_folder):
|
||||
os.mkdir(output_folder)
|
||||
|
||||
count = 0
|
||||
for root, _, filenames in os.walk(input_folder):
|
||||
for fn in filenames:
|
||||
if fn.endswith('.jpg'):
|
||||
count += 1
|
||||
shutil.copy(os.path.join(root, fn), os.path.join(output_folder, 'c_{:010d}.jpg'.format(count)))
|
||||
|
||||
if __name__ == '__main__':
|
||||
merge_images('p', 'output')
|
0
vinniesniper-54816/task1/_lab/003-crawler/notes.md
Normal file
0
vinniesniper-54816/task1/_lab/003-crawler/notes.md
Normal file
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.head.in.white.background/000032.png
(Stored with Git LFS)
Normal file
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.head.in.white.background/000032.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.running.in.white.background/000049.png
(Stored with Git LFS)
Normal file
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.running.in.white.background/000049.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.shitting.in.white.background/000046.png
(Stored with Git LFS)
Normal file
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.shitting.in.white.background/000046.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.shitting.in.white.background/000049.png
(Stored with Git LFS)
Normal file
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.shitting.in.white.background/000049.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.sitting.in.white.background/000059.png
(Stored with Git LFS)
Normal file
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.sitting.in.white.background/000059.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.sitting.in.white.background/000060.png
(Stored with Git LFS)
Normal file
BIN
vinniesniper-54816/task1/_lab/003-crawler/p/horse.sitting.in.white.background/000060.png
(Stored with Git LFS)
Normal file
Binary file not shown.
10
vinniesniper-54816/task1/_lab/003-crawler/run.sh
Executable file
10
vinniesniper-54816/task1/_lab/003-crawler/run.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
rm -rf p/*
|
||||
rm -rf n/*
|
||||
|
||||
# python ./crawler.py
|
||||
python ./crawler_horse.py
|
||||
# python ./crawler_n.py
|
Reference in New Issue
Block a user