Practical Projects Using CNN and RNN
In this chapter, you will apply everything you have learned throughout the course.
We will build real-world deep learning projects using both CNNs (for image tasks)
and RNN/LSTM models (for text and sequence tasks). These projects are perfect for
students, beginners, and anyone who wants hands-on experience with deep learning.
These projects are chosen because they cover the most in-demand skills today:
- Image classification
- Object detection basics
- Facial emotion detection
- Sentiment analysis
- Text generation (NLP)
- Time-series forecasting
Let’s start with CNN-based projects and then move to RNN-based projects.
⭐ PART 1 – Projects Using CNN
📌 Project 1: Image Classification (Cats vs Dogs)
This is one of the most famous deep learning problems.
The goal is to classify whether an image contains a cat or a dog.
Dataset: Kaggle Cats vs Dogs (25,000 images)
Step-by-Step:
1. Import Libraries
from tensorflow import keras
from keras import layers
import tensorflow as tf
2. Build CNN Model
model = keras.Sequential([
layers.Conv2D(32, (3,3), activation='relu', input_shape=(150,150,3)),
layers.MaxPooling2D(2,2),
layers.Conv2D(64, (3,3), activation='relu'),
layers.MaxPooling2D(2,2),
layers.Conv2D(128, (3,3), activation='relu'),
layers.MaxPooling2D(2,2),
layers.Flatten(),
layers.Dense(512, activation='relu'),
layers.Dense(1, activation='sigmoid')
])
3. Compile
model.compile(loss='binary_crossentropy',
optimizer='adam',
metrics=['accuracy'])
4. Train and Evaluate
With GPU support, this project is easy and produces >90% accuracy.
📌 Real-Life Use Cases:
- Pet recognition systems
- Camera AI (detect animals in wildlife)
- Security systems (identify intruders)
📌 Project 2: Facial Expression Recognition
CNNs are perfect for detecting human emotions from facial expressions:
- Happy
- Sad
- Angry
- Fear
- Neutral
Dataset: FER-2013
Architecture:
model = keras.Sequential([
layers.Conv2D(64, (3,3), activation='relu'),
layers.Conv2D(64, (3,3), activation='relu'),
layers.MaxPooling2D(),
layers.Dropout(0.25),
layers.Conv2D(128, (3,3), activation='relu'),
layers.MaxPooling2D(),
layers.Dropout(0.25),
layers.Flatten(),
layers.Dense(1024, activation='relu'),
layers.Dense(7, activation='softmax')
])
This model is used in:
- Mood detection apps
- Classroom engagement monitoring
- Marketing and customer reactions
📌 Project 3: Image Denoising with Autoencoders (CNN-based)
This project uses Autoencoders to remove noise from images.
model = keras.Sequential([
layers.Conv2D(32, (3,3), activation='relu', padding='same'),
layers.MaxPooling2D((2,2), padding='same'),
layers.Conv2D(32, (3,3), activation='relu', padding='same'),
layers.UpSampling2D((2,2)),
layers.Conv2D(3, (3,3), activation='sigmoid', padding='same')
])
Use cases: restoring old photos, improving CCTV footage.
⭐ PART 2 – Projects Using RNN / LSTM / GRU
📌 Project 4: Sentiment Analysis (Positive/Negative Classification)
Sentiment analysis is one of the most common NLP tasks.
The model reads text like reviews and classifies whether the feeling is positive or negative.
model = keras.Sequential([
layers.Embedding(10000, 32),
layers.LSTM(64),
layers.Dense(1, activation='sigmoid')
])
Accuracy usually reaches 88–92%.
📌 Real-Life Uses:
- Review analysis (Amazon, Google Play)
- Customer feedback interpretation
- Political sentiment tracking
📌 Project 5: Text Generation Using LSTM
LSTMs can generate new text in the style of:
- Stories
- Song lyrics
- Poems
- Movie dialogues
model = keras.Sequential([
layers.Embedding(total_words, 128),
layers.LSTM(256),
layers.Dense(total_words, activation='softmax')
])
After training, the model can generate new sentences word-by-word.
📌 Example Output:
“Deep learning opens the door to a new world of innovation…”
📌 Project 6: Time-Series Forecasting (Stock Price Prediction)
LSTMs and GRUs are excellent for time-series tasks like stock prices.
model = keras.Sequential([
layers.LSTM(50, return_sequences=True),
layers.LSTM(50),
layers.Dense(1)
])
This model predicts the next close price based on past data.
📌 Real-Life Use Cases:
- Weather forecasting
- Sales prediction
- Energy usage estimation
📌 Project 7: Language Translation (Sequence-to-Sequence Models)
A sequence-to-sequence (seq2seq) RNN model can translate:
- English → Hindi
- English → French
- Urdu → English
encoder = layers.LSTM(256, return_state=True)
decoder = layers.LSTM(256, return_sequences=True)
This is the foundation of Google Translate (older versions).
📌 Project 8: Next-Word Prediction
Similar to smartphone keyboards.
Input: “Deep learning is”
Model predicts: amazing / powerful / the future
📌 Project 9: Music Generation
RNNs can learn musical sequences and create new melodies.
model = keras.Sequential([
layers.LSTM(128, return_sequences=True),
layers.LSTM(128),
layers.Dense(88, activation='softmax')
])
This is used in AI music apps.
📌 Summary
This chapter covered practical CNN and RNN projects such as image classification,
facial emotion detection, sentiment analysis, text generation, and forecasting.
These projects help you apply deep learning concepts to real-world problems.
By now, you are ready to build your own AI applications using the techniques learned
in this complete course.
