Memuat
Memuat
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Class Deep Learning CNN-LSTM Pneumonia Detection #4: Hybrid CNN-LSTM Architecture: Spatial Features + Sequence”.
Other ways we can help with Python.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

Multi-Objective Optimization Course: NSGA-II, MOPSO & Hybrid Algorithms (Python)

ECG Arrhythmia Classification Course with Wavelet & Deep Learning (PyTorch)

ANFIS + PSO/GA Course for Non-Linear Time Series Forecasting (Python)
Have it built for you
No time to learn Python? Our team can do the project for you.

Python Machine Learning — Prediction Models, Customer Segmentation, Fraud Detection & AI Apps

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9
Get notified about new Python classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
Here is the final result, the hybrid CNN-LSTM architecture we designed ourselves. CNN extracts spatial features from the ronken, then the bidirectional LSTM reads the feature map row by row, from the top of the lung down to the base, like a doctor's eye tracing the image. We also check the tensor shape at each stage to make sure nothing is wrong. Let's start. Hello, welcome to episode four of the hybrid CNN-LSTM model series for early detection of lung diseases. This is the core of our research. CNN is very good at recognizing local patterns such as edges and textures, but it doesn't pay much attention to the relationship between distant parts of the image. LSTM, a type of recurrent neural network, excels at understanding sequences and context. By combining both, the model can see local details as well as patterns from top to bottom of the lung.
Create a model file named underscore hybrid dot py. The first part is the CNN, the same as the baseline, 3 blocks on to the, back norm, relu, and max pull. For 64x64 images, the output is a 64-channel feature map of size 8x8. Using the same CNN makes the comparison with the baseline fair. The difference in results truly comes from the addition of LSTM. The second part is the bidirectional or bidirectional LSTM.
The input size is 64 channels x 8 columns, that is 512, with hidden size 128. Because it's bidirectional, the output is 256. One direction reads from top to bottom, the other from bottom to top. Then dropout and linear to the two classes. The key lies in the forward method.
Feature maps have the shape back, channel, height, width. With permute, we move height to the front, then reshape, so that each row of the feature map becomes one time step containing 512 numbers. Thus, LSTM reads eight time steps, each representing one horizontal lung stripe. The output of the last time step is used for classification.
When designing the architecture, always check the tensor shape. We send back four random images, then print the shape at each stage. Input 4, 1, 64, 64, output CNN 4, 64, 8, 8, sequence LSTM 4, 8, 512, and final output 4, 2. The number of parameters is around 680 thousand, much larger than the CNN baseline which is around 32 thousand, due to the LSTM weights.
Done. We have designed the hybrid CNN-LSTM architecture, understood how to convert feature maps into sequences, used bidirectional LSTM, and verified the tensor shape. In the next episode, we will train this model with class weights, learning rate scheduler, and early stopping. Working on a thesis, dissertation, or AI research in the field of medical imaging? Cerdas Inovasi Digital helps implement deep learning, from CNN, LSTM, hybrid models, up to CAM grade interpretation and result writing, as well as opening deep learning courses with Python. Want to master the entire series, from Röntgen datasets to evaluation and CAM grading? All six episodes, complete with step-by-step PDF guides and source code, are available to premium tutorial subscribers. Subscribe starting at Rp69.000 per month, save 28% with the 12-month package, or pay once Rp999.000 for lifetime access. Want a single class only? Buy individual classes with lifetime access. Subscribe now at the premium page cerdasinovasidigital.com. Contact our WhatsApp, or visit cerdasinovasidigital.com. Thank you for watching, see you in the next episode. Thank you for watching,
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →