Dog-Cat Classification

Dog-Cat Classification

A web application that uses a Convolutional Neural Network (CNN) to classify uploaded images as dog or cat, featuring a user-friendly interface and a REST API endpoint for programmatic access.

Python Flask TensorFlow Keras CNN Deep Learning
View on GitHub

Model Architecture

Key Features

Prediction Endpoint (excerpt)

python
@app.route('/predict', methods=['POST'])
def predict():
    file = request.files['image']
    img = image.load_img(file, target_size=(150, 150))
    img_array = image.img_to_array(img) / 255.0
    img_array = np.expand_dims(img_array, axis=0)
    prediction = model.predict(img_array)
    label = 'Dog' if prediction[0][0] > 0.5 else 'Cat'
    return jsonify({'result': label, 'confidence': float(prediction[0][0])})

References & Links