Giter Site home page Giter Site logo

2023-2b-t2-m8-p6's Introduction

2023-2B-T2-M8-P6

Quick Starter

This quick starter provides a simple example of using the MNIST dataset with TensorFlow and Keras. It includes a Convolutional Neural Network (CNN) for digit classification, training the model, and evaluating its performance.

Requirements

Ensure you have the required dependencies installed by running:

Currently using Python 3.11

pip install -r requirements.txt

Usage

  1. Run the main.py file to train the model and execute predictions on the test dataset.
python main.py

Code Overview

The code in main.py contains a class MNISTClassifier encapsulating the MNIST model and related functions. It includes the following methods:

  • train_model(epochs): Trains the model on the MNIST training dataset for the specified number of epochs.
  • evaluate_model(): Evaluates the trained model on the MNIST test dataset and prints the test accuracy.
  • predict_samples(num_samples): Displays predictions for a specified number of samples from the test dataset.

Additionally, the code includes a test class TestMNISTClassifier within which there is a test method test_model_evaluation. This method checks if the model is initialized, trains it, evaluates its accuracy, and predicts samples, ensuring the accuracy is above a specified threshold.

MNISTClassifier Class

The MNISTClassifier class utilizes TensorFlow and Keras to define, compile, and train a Convolutional Neural Network for digit classification on the MNIST dataset. The architecture consists of a convolutional layer, max-pooling layer, flattening layer, and dense layers.

Notes

  • The test accuracy is checked to ensure it is greater than 95%.
  • Predictions for sample images are displayed using Matplotlib.

Demo

demo.webm

2023-2b-t2-m8-p6's People

Contributors

vinicioslugli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.