开源项目 `images-web-crawler` 使用教程

开源项目 images-web-crawler 使用教程

images-web-crawlerThis package is a complete tool for creating a large dataset of images (specially designed -but not only- for machine learning enthusiasts). It can crawl the web, download images, rename / resize / covert the images and merge folders.. 项目地址:https://gitcode.com/gh_mirrors/im/images-web-crawler

1. 项目的目录结构及介绍

images-web-crawler/
├── LICENSE
├── README.md
├── dataset_builder.py
├── images_downloader.py
├── sample.py
├── web_crawler.py
  • LICENSE: 项目的许可证文件,采用 GPL-3.0 许可证。
  • README.md: 项目的说明文档,包含项目的基本介绍和使用方法。
  • dataset_builder.py: 用于构建数据集的脚本。
  • images_downloader.py: 用于下载图片的脚本。
  • sample.py: 示例脚本,展示如何使用项目功能。
  • web_crawler.py: 核心脚本,负责爬取网页并收集图片链接。

2. 项目的启动文件介绍

项目的启动文件是 sample.py,它展示了如何使用 web_crawler.pyimages_downloader.py 来爬取和下载图片。

# sample.py
from web_crawler import WebCrawler

crawler = WebCrawler(api_keys)
crawler.collect_links_from_web(keywords, images_nbr, remove_duplicated_links=True)
crawler.save_urls(download_folder + "/links.txt")
crawler.download_images(keywords, target_folder=download_folder)

3. 项目的配置文件介绍

项目没有明确的配置文件,但可以通过修改 sample.py 中的参数来配置爬虫的行为。

  • api_keys: 用于访问某些 API 的密钥。
  • keywords: 要搜索的关键词列表。
  • images_nbr: 每个关键词要下载的图片数量。
  • download_folder: 图片下载的目标文件夹。

通过修改这些参数,可以定制爬虫的行为,例如更改搜索关键词、调整下载图片的数量等。

images-web-crawlerThis package is a complete tool for creating a large dataset of images (specially designed -but not only- for machine learning enthusiasts). It can crawl the web, download images, rename / resize / covert the images and merge folders.. 项目地址:https://gitcode.com/gh_mirrors/im/images-web-crawler

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

束斯畅Sharon

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值