Skip to content

About

Scraping of images from Flickr (sea, mountains, buildings), indexes datasets, models, and predictions in Elasticsearch, trains a Linear SVC with HOG features for image classification, and provides a Telegram bot as the user interface to classify images directly from a smartphone.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Image Recognition

Scraping, indexing and classification with a Telegram Bot

This project scrapes images from Flickr, indexes them into Elasticsearch, and trains image classifiers (HOG + SVM). It also includes a Telegram bot for inference.

Requirements

  • Linux OS or virtual machine
  • Python 3.9 (conda environment recommended)
  • Reachable Elasticsearch (default https://localhost:9200)
  • Chrome/Chromedriver installed

Environment setup

  1. Create the conda env using img_class.yml: conda env create -f img_class.yml
  2. Copy .env.example to .env and fill in the values:

Main .env variables:

  • TELEGRAM_TOKEN: your Telegram bot token
  • ELASTIC_HOST: Elasticsearch URL (e.g. https://localhost:9200)
  • ELASTIC_PASSWORD: password for elastic user
  • ELASTIC_CA_CERT: path to CA certificate if applicable (optional)
  • DRIVER_PATH: path to chromedriver
  • DOWNLOADS_PATH: root folder for images (e.g. Imagenes)
  • FLICKR_USERNAME, FLICKR_PASSWORD: Flickr credentials (optional, if logging in)
  • MODELS_PATH: models folder (e.g. Modelos)
  1. Add a driver_path folder with the chromedriver executable.

Project structure

  • main.py: orchestrates scraping, split, indexing and training
  • bot.py: Telegram bot for classification
  • scraping.py: Selenium helpers (search and download)
  • indexation.py: Elasticsearch connection and indexing
  • model.py: model training and evaluation
  • config.py: environment variable loader
  • Modelos/: saved models
  • Imagenes/: dataset (train/test/backup)

Run

  1. Execute the full pipeline:
python main.py
  1. Start the bot (after indices and models exist):
python bot.py

Security notes

  • Do not commit .env or any credentials.
  • Ensure ELASTIC_CA_CERT points to an accessible certificate if needed.

About

Scraping of images from Flickr (sea, mountains, buildings), indexes datasets, models, and predictions in Elasticsearch, trains a Linear SVC with HOG features for image classification, and provides a Telegram bot as the user interface to classify images directly from a smartphone.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages