This project scrapes images from Flickr, indexes them into Elasticsearch, and trains image classifiers (HOG + SVM). It also includes a Telegram bot for inference.
- Linux OS or virtual machine
- Python 3.9 (conda environment recommended)
- Reachable Elasticsearch (default
https://localhost:9200) - Chrome/Chromedriver installed
- Create the conda env using
img_class.yml: conda env create -f img_class.yml - Copy
.env.exampleto.envand fill in the values:
Main .env variables:
TELEGRAM_TOKEN: your Telegram bot tokenELASTIC_HOST: Elasticsearch URL (e.g.https://localhost:9200)ELASTIC_PASSWORD: password forelasticuserELASTIC_CA_CERT: path to CA certificate if applicable (optional)DRIVER_PATH: path tochromedriverDOWNLOADS_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)
- Add a
driver_pathfolder with the chromedriver executable.
main.py: orchestrates scraping, split, indexing and trainingbot.py: Telegram bot for classificationscraping.py: Selenium helpers (search and download)indexation.py: Elasticsearch connection and indexingmodel.py: model training and evaluationconfig.py: environment variable loaderModelos/: saved modelsImagenes/: dataset (train/test/backup)
- Execute the full pipeline:
python main.py- Start the bot (after indices and models exist):
python bot.py- Do not commit
.envor any credentials. - Ensure
ELASTIC_CA_CERTpoints to an accessible certificate if needed.