This repository contains code for letter classification using a neural network model. The code is written in Python and utilizes TensorFlow, Keras, and scikit-learn libraries. It provides functions for data preprocessing, model creation and training, and prediction on test data. Link to data gatherer function
The code implements the following methods:
Data Preprocessing: The data_preprocessing function is responsible for loading the data from a CSV file and performing preprocessing steps. The preprocessing steps include dropping the first column, dropping columns with names starting with "world_landmark_" and "handedness", and splitting the data into features (X) and labels (y).
Model Creation and Training: The create_model function builds and trains a neural network model. The model architecture consists of three dense layers with dropout regularization between them. The model is compiled with the "adam" optimizer and the loss function is set to "categorical_crossentropy". The model is trained on the preprocessed data for a specified number of epochs.
Model Loading: The load_model function loads a trained model from a file. If the model file does not exist, it calls the create_model function to create and train a new model. The label encoder used for encoding and decoding the labels is also loaded from a file.
Model Evaluation: The check_model function takes a trained model and test data as input and evaluates the model's performance on the test data. It preprocesses the test data, makes predictions using the model, and decodes the predicted labels using the label encoder.
Perform Processing: The perform_processing function serves as the main entry point for processing data. It loads the trained model using the load_model function and performs prediction on the input data. The predicted labels are stored in a DataFrame and returned as the output.
To use this code for processing your own data, follow these steps:
Install the required libraries using command pip install -r requirements.txt
Place your input data in a CSV file with the same format as the provided Train_dataset.csv file.
Run the script with following command python main.py /path/to/csv/file /path/and/name/where/you/want/result
For any questions or issues, please feel free to open an issue in this repository.