{"id":15361524,"url":"https://github.com/muhd-umer/torch-classification","last_synced_at":"2026-01-19T13:33:09.283Z","repository":{"id":212334812,"uuid":"731228575","full_name":"muhd-umer/torch-classification","owner":"muhd-umer","description":"PyTorch-based image classification with super-resolution support","archived":false,"fork":false,"pushed_at":"2024-01-02T14:59:28.000Z","size":5618,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T21:49:28.607Z","etag":null,"topics":["cnn","computer-vision","deep-learning","image-classification","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muhd-umer.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-13T16:03:52.000Z","updated_at":"2024-11-24T02:46:11.000Z","dependencies_parsed_at":"2023-12-30T11:34:24.940Z","dependency_job_id":"9d7d8125-e31e-4de5-9f76-166a7f92c267","html_url":"https://github.com/muhd-umer/torch-classification","commit_stats":null,"previous_names":["muhd-umer/torch-classification"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/muhd-umer/torch-classification","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhd-umer%2Ftorch-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhd-umer%2Ftorch-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhd-umer%2Ftorch-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhd-umer%2Ftorch-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhd-umer","download_url":"https://codeload.github.com/muhd-umer/torch-classification/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhd-umer%2Ftorch-classification/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28569233,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T12:50:50.164Z","status":"ssl_error","status_checked_at":"2026-01-19T12:50:42.704Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cnn","computer-vision","deep-learning","image-classification","pytorch"],"created_at":"2024-10-01T12:55:30.525Z","updated_at":"2026-01-19T13:33:09.269Z","avatar_url":"https://github.com/muhd-umer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Torch Classification\n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![PyTorch](https://img.shields.io/badge/PyTorch-2.1.1-orange.svg)](https://pytorch.org/) [![CIFAR-100](https://img.shields.io/badge/Dataset-CIFAR--100-green.svg)](https://www.cs.toronto.edu/~kriz/cifar.html)\n\nTorch Classification is a PyTorch-based image classification project showcasing the implementation of the [EfficientNet V2](https://arxiv.org/abs/2104.00298) family to classify images. This project covers training the model from scratch and employing transfer learning with pre-trained weights specifically on the CIFAR-100 dataset. Additionally, it delves into the impact of leveraging GANs (BSRGAN \u0026 SwinIR) for image super-resolution on the same CIFAR-100 dataset. This initiative was undertaken as part of a Machine Learning course at \u003ca href=\"https://nust.edu.pk/\"\u003eNUST\u003c/a\u003e, emphasizing practical applications of deep learning.\n\n## Installation\nTo get started with this project, follow the steps below:\n\n- Clone the repository to your local machine using the following command:\n\n    ```fish\n    git clone https://github.com/muhd-umer/torch-classification.git\n    ```\n\n- It is recommended to create a new virtual environment so that updates/downgrades of packages do not break other projects. To create a new virtual environment, run the following command:\n\n    ```fish\n    conda env create -f environment.yml\n    ```\n\n- Alternatively, you can use `mamba` (faster than conda) package manager to create a new virtual environment:\n\n    ```fish\n    wget -O miniforge.sh \\\n         \"https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh\"\n    bash miniforge.sh -b -p \"${HOME}/conda\"\n\n    source \"${HOME}/conda/etc/profile.d/conda.sh\"\n\n    # For mamba support also run the following command\n    source \"${HOME}/conda/etc/profile.d/mamba.sh\"\n\n    conda activate\n    mamba env create -f environment.yml\n    ```\n\n- Activate the newly created environment:\n\n    ```fish\n    conda activate torch-classification\n    ```\n\n- Install the PyTorch Ecosystem:\n\n    ```fish\n    # pip will take care of necessary CUDA packages\n    pip3 install torch torchvision torchaudio\n\n    # additional packages (already included in environment.yml)\n    pip3 install einops python-box timm torchinfo \\\n                 lightning rich wandb rawpy\n    ```\n\n## Dataset\nThe CIFAR-100 dataset is used for training and testing the model. The dataset can be downloaded from [here](https://www.cs.toronto.edu/~kriz/cifar.html).\n\nOr, you can use the following commands to download the dataset:\n\n```fish\n# download as python pickle\ncd data\ncurl -O https://www.cs.toronto.edu/~kriz/cifar-100-python.tar.gz\ntar -xvzf cifar-100-python.tar.gz\n\n# download as ImageNet format\npip3 install cifar2png\ncifar2png cifar100 data/cifar100\n```\n\nWe also offer super-resolution variants of the CIFAR-100 dataset, which have upscaled the images to `128x128` resolution using [BSRGAN 4x](https://github.com/cszn/BSRGAN) and [SwinIR](https://github.com/JingyunLiang/SwinIR). You can download these dataset from the [Weights \u0026 Data](https://github.com/muhd-umer/torch-classification/releases/) section. Or, you can use the following commands to download the dataset:\n\n```fish\nwget -O data/bsrgan_4x_cifar100.zip \\\n    \"https://github.com/muhd-umer/torch-classification/releases/download/v0.0.1/bsrgan_4x_cifar100.zip\"\n\n# unzip the dataset\nunzip -q data/bsrgan_4x_cifar100.zip -d data/\n\n# or\nwget -O data/swinir_4x_cifar100.zip \\\n    \"https://github.com/muhd-umer/torch-classification/releases/download/v0.0.1/swinir_4x_cifar100.zip\"\n\n# unzip the dataset\nunzip -q data/swinir_4x_cifar100.zip -d data/\n```\n\n## Usage\nTo train the model from scratch, run the following command:\n\n```fish  \n# train the model from scratch using default config\npython3 train.py\n\n# train the model from scratch using overrides\npython3 train.py --mode MODE \\  # (train, finetune)\n                 --data-dir DATA_DIR \\  # directory containing data\n                 --model-dir MODEL_DIR \\  # directory to save model\n                 --batch-size BATCH_SIZE \\  # batch size\n                 --dataset-type DATASET_TYPE \\  # (default, imagefolder)\n                 --num-workers NUM_WORKERS \\  # number of workers\n                 --num-epochs NUM_EPOCHS \\  # number of epochs\n                 --lr LR \\  # learning rate\n                 --rich-progress \\  # use rich progress bar\n                 --accelerator ACCELERATOR \\  # type of accelerator\n                 --devices DEVICES \\  # number of devices\n                 --weights WEIGHTS \\  # path to weights file\n                 --resume \\  # resume training from checkpoint\n                 --test-only \\  # test the model on test set\n                 --logger-backend LOGGER_BACKEND  # (wandb, tensorboard)\n```\n\nTo evaluate the models, download the appropriate weights from the [Weights \u0026 Data](https://github.com/muhd-umer/torch-classification/releases/) section and place them in `weights/` directory. Then, run the following command:\n\n```fish\nbash run.sh\n\n# or\npython3 train.py --weights WEIGHTS --test-only\n```\n\n\n## Project Structure\nThe project is structured as follows:\n\n```fish\ntorch-classification\n├── data/             # data directory\n├── models/           # model directory\n├── resources/        # resources directory\n├── utils/            # utility directory\n├── LICENSE           # license file\n├── README.md         # readme file\n├── environment.yml   # conda environment file\n├── upscale.py        # upscaling script\n└── train.py          # training script\n```\n\n## Contributing ❤️\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhd-umer%2Ftorch-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhd-umer%2Ftorch-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhd-umer%2Ftorch-classification/lists"}