image-caption-scraper
About
This package allows downloading images and their corresponding captions from web search engines like Google Images, Yahoo Image, Flickr, and more to come.
The model is particularly targetting researchers for building their own datasets of their own concepts, and can thus train machine learning models for computer vision, natural language processing, and the intersection of both (image captioning, visual relationship detection).
The pipeline is completely based on Selenium web driver.
Table of Contents
Installation
pip install image-caption-scraper
Requirements
Python 3.6 or later with all requirements.txt dependencies installed. To install run:
pip install -r requirements.txt
Also, make sure to download chrome-driver from https://chromedriver.chromium.org/ and either add it to the system variables path, or type down the full path to the .exe file in the options below.
Usage
from image_caption_scraper import Image_Caption_Scraper
scraper = Image_Caption_Scraper(
engine="all", # or "google", "yahoo", "flickr"
num_images=100,
query="dog chases cat",
out_dir="images",
headless=True,
driver="chromedriver",
expand=False,
k=3
)
scraper.scrape(save_images=True)
Options
| Argument | Description | Options |
|---|---|---|
| engine | Search engine to scrape images from. By default it searches through all the available engines (currently supports Google, Flickr, Yahoo). | "all","google","flickr","yahoo" |
| num_images | Number of images targetted by the user | Any number (int) > 0 |
| query | The text query to search for | Any text query |
| out_dir | Output directly to save the images and captions | Any text string |
| headless | Argument to hide the browser while crawling the web pages or show it. True will hide, False will open it | 'True' or 'False' |
| expand | Argument to expand the input query. Expansions supports synonyms from wordnet at the moment. Translations are coming soon. | 'True' or 'False' |
| driver | The web driver to navigate the web pages. Download the driver from https://chromedriver.chromium.org/ | Default='chromedriver' (configured in System Path). Otherwise just type the path to the .exe file |
| k | If expand==True, k determines how many synonyms to fetch from wordnet for each word in the query. It is assumed that words are separated by spaces. The model fetches the closest k synonyms for each word by path_similarity in the wordnet graph. | 'True' or 'False' |
| save_images | If True the model will save the images+captions in the out_dir folder. Otherwise it will only save the meta-data (with urls) without the images. | 'True' or 'False' |
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Email: alishibli97@hotmail.com
TODO
- Verify large dataset collections (quality and time wise)
- Implement parallel execution for faster data collection
- Expand queries using more methods like transations and other.
Metadata
Release files for image-caption-scraper 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| image_caption_scraper-0.0.3.tar.gz | 10.3 kB | Without provenance | Details for image_caption_scraper-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| image_caption_scraper-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for image_caption_scraper-0.0.3-py3-none-any.whl |
Total release size: 20.0 kB
Release files / image_caption_scraper-0.0.3.tar.gz
| Download URL | image_caption_scraper-0.0.3.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e64c174cbbba8339162511ee0555900c6abe06641668236a22c5325a2ad85774
|
|
BLAKE2b-256 checksum How to use checksums |
f1da295b264a4101de98d16b29d325d394b3f3634dcf9bc2d55cef3881a1b465
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / image_caption_scraper-0.0.3-py3-none-any.whl
| Download URL | image_caption_scraper-0.0.3-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
052d7cbede597a2547688f8f1fba2b4c0b03565bc28e0c187f9b5b11876def22
|
|
BLAKE2b-256 checksum How to use checksums |
34f49445bc0ab7ebb38d0bcbee8e3e4221f808dec2916f862cf0c90a80553534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for image-caption-scraper 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.