This project uses a configurable Convolutional Neural Network (CNN) to sort images into categories. It uses a JSON-defined model architecture for easy configuration.
.
├── categories/ # Training images, organized by category
├── model_cnn.py # Shared CNN model class
├── model.jsonc # Model architecture/configuration
├── requirements.txt # Python dependencies
├── sort.py # Script to sort images
├── suggestions/ # Output folder for sorted images
├── tosort/ # Images to be sorted
├── train.py # Script to train the model
- Clone the repository and navigate to the project folder.
- Run
./install.sh
Place your training images in categories/<category>/. Each subfolder is a class.
Run:
python train.pyThis will train the CNN and save the model to trained_model.pth.
Place images to be sorted in the tosort/ folder.
Run:
python sort.pyImages will be copied into suggestions/<predicted_category>/ based on the model's predictions.
- Images are automatically resized for training and sorting (no modification of originals).
- Model architecture is defined in
model.jsonc. - Corrupted or unreadable images are skipped automatically.
- Python 3.8+
- See
requirements.txtfor required packages (PyTorch, torchvision, Pillow, etc.)