Logo Lanfrica

BakungaBronson/CreativeCommonsImageCollection

Record type:

software
Creator:
Bak
Host:
A Python tool that auto-generates culturally specific search terms, then downloads and filters Creative-Commons images of African cultures using Wikipedia/Bing context and the Bing Image Crawler. # Creative Commons Cultural Image Collector **Purpose** Collect culturally relevant, Creative-Commons images for a list of African (and related) cultures. The script generates rich search terms with the help of Wikipedia, Bing snippets and an optional Gemini LLM, then downloads images with `icrawler` (Bing only) and applies basic quality filtering. --- ## Features 1. **Automatic search-term generation** • Wikipedia API lookup (exact + search fallback) • Web-snippet scrape (Bing) if Wikipedia is sparse • Optional Gemini-2 LLM expansion • Hard-coded template as a guaranteed last resort 2. **Creative-Commons download pipeline** • Uses `BingImageCrawler` (icrawler) with licence and adult-filter flags • Directory per culture & CSV log of every file 3. **Quality filtering** • Rejects very small, corrupt or blank images via OpenCV • Keeps statistics on removed vs accepted files 4. **Config-first design** All tunable values live in the **USER CONFIGURATION** block at the top of `image_collect.py`. --- ## Quick-start ```bash # 1. Clone the repo $ git clone github.com $ cd CreativeCommonsImageCollection # 2. Create a virtual environment (recommended) $ python -m venv .venv $ source .venv/bin/activate # Windows: .venv\Scripts\activate # 3. Install requirements $ pip install -r requirements.txt # 4. Set API keys (optional but recommended) # Gemini (Google Generative AI) $ export GOOGLE_API_KEY="your-gemini-key" # 5. Run the script $ python image_collect.py ``` > 💡 The script will still work without a Gemini key; it will simply skip the LLM enrichment tier. --- ## Configuration Cheatsheet (top of `image_collect.py`) | Variable | Purpose | Typical value | |----------|---------|---------------| | `CULTURES` | List of cultures to process | `["Swahili", "Igbo", …]` | | `USE_WIKIPEDIA_CONTEXT` | Toggle Wikipedia lookup | `True / False` | | `IMAGES_PER_TERM` (`images_per_term`) | How many images to download for ea …

Languages