{"id":18631150,"url":"https://github.com/aimagelab/camel","last_synced_at":"2025-04-11T06:31:50.222Z","repository":{"id":44790695,"uuid":"451480159","full_name":"aimagelab/camel","owner":"aimagelab","description":"CaMEL: Mean Teacher Learning for Image Captioning. ICPR 2022","archived":false,"fork":false,"pushed_at":"2022-12-01T10:27:57.000Z","size":8868,"stargazers_count":29,"open_issues_count":4,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-08T16:35:59.343Z","etag":null,"topics":["artificial-intelligence","captioning","captioning-images","computer-vision","image-captioning","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aimagelab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-24T13:42:30.000Z","updated_at":"2024-10-31T03:30:07.000Z","dependencies_parsed_at":"2023-01-23T20:00:18.797Z","dependency_job_id":null,"html_url":"https://github.com/aimagelab/camel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimagelab%2Fcamel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimagelab%2Fcamel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimagelab%2Fcamel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimagelab%2Fcamel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimagelab","download_url":"https://codeload.github.com/aimagelab/camel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248356115,"owners_count":21090158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","captioning","captioning-images","computer-vision","image-captioning","pytorch"],"created_at":"2024-11-07T05:05:48.178Z","updated_at":"2025-04-11T06:31:49.484Z","avatar_url":"https://github.com/aimagelab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CaMEL: Mean Teacher Learning for Image Captioning\nThis repository contains the reference code for the paper _[CaMEL: Mean Teacher Learning for Image Captioning](https://arxiv.org/pdf/2202.10492.pdf)_.\n\nPlease cite with the following BibTeX:\n```\n@inproceedings{barraco2022camel,\n  title={{CaMEL: Mean Teacher Learning for Image Captioning}},\n  author={Barraco, Manuele and Stefanini, Matteo and Cornia, Marcella and Cascianelli, Silvia and Baraldi, Lorenzo and Cucchiara, Rita},\n  booktitle={International Conference on Pattern Recognition},\n  year={2022}\n}\n```\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./images/camel.png\" width=\"90%\" align=\"center\"/\u003e\n\u003c/p\u003e\n\n## Environment setup\nClone the repository and create the `camel_release` conda environment using the `environment.yml` file:\n```\nconda env create -f environment.yml\nconda activate camel_release\n```\n\nNote: Python 3.8 is required to run our code. \n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./images/camel.gif\" width=\"30%\" align=\"center\"/\u003e\n\u003c/p\u003e\n\n## Data preparation\nTo run the code, annotations and images for the COCO dataset are needed.\nPlease download the zip files containing the images ([train2014.zip](http://images.cocodataset.org/zips/train2014.zip), [val2014.zip](http://images.cocodataset.org/zips/val2014.zip)), and the annotations ([annotations.zip](https://aimagelab.ing.unimore.it/go/coco_annotations)) and extract them. \nThese paths will be set as arguments later.\n\n## Evaluation\nTo reproduce the results reported in our paper, download the pretrained model file [camel_mesh.pth](https://aimagelab.ing.unimore.it/go/camel_mesh.pth) or [camel_nomesh.pth](https://aimagelab.ing.unimore.it/go/camel_nomesh.pth) and place it anywhere. Its path will be set as argument later.\n\nRun `python evaluation.py` using the following arguments:\n\n| Argument | Possible values |\n|------|------|\n| `--batch_size` | Batch size (default: `25`) |\n| `--workers` | Number of workers (default: `0`) |\n| `--resume_last` | If used, the training will be resumed from the last checkpoint |\n| `--resume_best` | If used, the training will be resumed from the best checkpoint |\n| `--annotation_folder` | Path to folder with COCO annotations (required) |\n| `--image_folder` | Path to folder with COCO images (required) |\n| `--saved_model_path` | Path to model weights file (required) |\n| `--clip_variant` | CLIP variant to be used as image encoder (default: `RN50x16`) |\n| `--network` | Network to be used in the evaluation, `online` or `target` (default: `target`) |\n| `--disable_mesh` | If used, the model does not employ the mesh connectivity |\n| `--N_dec` | Number of decoder layers (default: `3`) |\n| `--N_enc` | Number of encoder layers (default: `3`) |\n| `--d_model` | Dimensionality of the model (default: `512`) |\n| `--d_ff` | Dimensionality of Feed-Forward layers (default: `2048`) |\n| `--m` | Number of memory vectors (default: `40`) |\n| `--head` | Number of heads (default: `8`) |\n\nFor example, to evaluate our model, use\n```\npython evaluate.py --image_folder /path/to/images --annotation_folder /path/to/annotations --saved_model_path /path/to/model_file.pth\n```\n\n## Training procedure\nRun `python train.py` using the following arguments:\n\n| Argument | Possible values |\n|------|------|\n| `--exp_name` | Experiment name (default: `camel`) |\n| `--batch_size` | Batch size (default: `25`) |\n| `--workers` | Number of workers (default: `0`) |\n| `--resume_last` | If used, the training will be resumed from the last checkpoint |\n| `--resume_best` | If used, the training will be resumed from the best checkpoint |\n| `--annotation_folder` | Path to folder with COCO annotations (required) |\n| `--image_folder` | Path to folder with COCO images (required) |\n| `--clip_variant` | CLIP variant to be used as image encoder (default: `RN50x16`) |\n| `--distillation_weight` | Weight for the knowledge distillation loss (default: `0.1` in XE phase, `0.005` in SCST phase) |\n| `--ema_weight` | Target decay rate of Mean Teacher paradigm (default: `0.999`) |\n| `--phase` | Training phase, `xe` or `scst` (default: `xe`) |\n| `--disable_mesh` | If used, the model does not employ the mesh connectivity |\n| `--saved_model_file` | If used, path to model weights to be loaded |\n| `--N_dec` | Number of decoder layers (default: `3`) |\n| `--N_enc` | Number of encoder layers (default: `3`) |\n| `--d_model` | Dimensionality of the model (default: `512`) |\n| `--d_ff` | Dimensionality of Feed-Forward layers (default: `2048`) |\n| `--m` | Number of memory vectors (default: `40`) |\n| `--head` | Number of heads (default: `8`) |\n| `--warmup` | Warmup value for learning rate scheduling (default: `10000`) |\n\nFor example, to train our model with the parameters used in our experiments, use\n```\npython train.py --image_folder /path/to/images --annotation_folder /path/to/annotations\n```\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./images/qualitatives.png\" width=\"100%\" align=\"center\"/\u003e\n\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimagelab%2Fcamel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimagelab%2Fcamel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimagelab%2Fcamel/lists"}