Skip to content
项目

ataturhan21/Cifar10-Image-Classification

在 GitHub 查看

关于

TensorFlow/Keras CNN for the Kaggle CIFAR-10 competition with data augmentation and submission generation.

机器学习

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

CIFAR-10 Image Classification

A TensorFlow/Keras notebook for the Kaggle CIFAR-10 competition. It loads archived images, trains a convolutional classifier, and generates predictions aligned with the sample submission.

Open the notebook · Dependencies

Model and workflow

  • Extract train.7z and test.7z; read labels from trainLabels.csv.
  • Load 32 × 32 images with OpenCV and normalize pixel values to 0–1.
  • Split training images into 80% training and 20% validation with random_state=42.
  • Use 3 convolutional blocks with 32, 64, and 128 filters, batch normalization, pooling, dropout, and L2 regularization.
  • Train with augmentation, Adam, early stopping, and learning-rate reduction. The current training call uses batch size 128 and a maximum of 5 epochs.
  • Export submission.csv with id and label columns.

Saved results

The committed notebook outputs come from one 5-epoch Kaggle run without an accelerator. They predate the later class-mapping and partial-batch fixes, so treat them as historical, not as a measurement of the current code.

Item Saved output
Training / validation / test images 40,000 / 10,000 / 300,000 (32 × 32 × 3)
Epoch 5 training accuracy / loss 0.5323 / 2.1703
Epoch 5 validation accuracy / loss 0.5529 / 2.0264

The notebook also includes the accuracy and loss curves from that run under Plotting Accuracy and Loss.

Run on Kaggle

  1. Create a notebook and attach the CIFAR-10 competition data.

  2. Import cifar10-image-classification.ipynb.

  3. Confirm these inputs in Loading the Dataset:

    • /kaggle/input/cifar-10/trainLabels.csv
    • /kaggle/input/cifar-10/sampleSubmission.csv
    • /kaggle/input/cifar-10/train.7z
    • /kaggle/input/cifar-10/test.7z
  4. Confirm that extraction writes to /kaggle/working/train and /kaggle/working/test.

  5. Run the cells in order and download submission.csv.

The current loader holds image arrays in memory. Check available RAM and storage before extracting and loading the full competition data.

Run locally

git clone https://github.com/ataturhan21/Cifar10-Image-Classification.git
cd Cifar10-Image-Classification
python -m venv .venv

Activate the environment, then run:

python -m pip install -r requirements.txt notebook
jupyter notebook cifar10-image-classification.ipynb

Download the competition data separately and replace the Kaggle input and extraction paths. Data archives and trained weights are not included. Saved metadata records Python 3.10.14; dependency versions are currently unpinned.

Prediction integrity

Training and prediction share the same explicit class mapping. Test images are loaded in sampleSubmission.csv ID order instead of filesystem order. Missing images, unknown labels, mismatched image counts, and unexpected prediction shapes raise errors before a misleading CSV is written.

Regression checks

The checks need only NumPy and pandas, so a light environment is enough:

python -m pip install numpy pandas
python -m unittest discover -s tests -v

Training includes the final partial batch, including datasets smaller than the batch size. The tests execute the notebook's loading, submission, and training-setup functions with synthetic inputs and small model/image doubles. They do not need TensorFlow, OpenCV, or the competition dataset.

The GitHub Actions workflow runs these same focused checks on Ubuntu and Windows with read-only repository access.

The existing notebook outputs are historical. The tests verify label and row alignment, not a newly measured model accuracy.

Copyright

© Ata Turhan. All rights reserved. This repository has no open-source license: its code may not be copied, modified or redistributed.

探索相关项目

加载中…