Skip to content

Codedchic25/Cap.-8-TensorFlow

Repository files navigation

Chapter 8: TensorFlow & Deep Learning Repository

A comprehensive, production-grade learning repository dedicated to mastering TensorFlow foundations, Convolutional Neural Networks (CNNs), and Transfer Learning. This project is built using modern developer workflows, including Keras 3 API standards, explicit input handling, and the uv package manager for robust virtual environment isolation.


📂 Project Architecture (Tree View)

Cap.8 TensorFlow/
├── .assets/                          # Persistent storage for artifacts (git-ignored)
│   ├── images/                       # Training curves and evaluation snapshots
│   └── saved_models/                 # Exported computational brains (.keras format)
├── .vscode/
│   └── settings.json                 # Pylance static analysis & environment fallback routes
├── Proiect_Final_TensorFlow/
│   ├── train_project.py              # End-to-end multi-layer CNN training pipeline
│   └── predict.py                    # Inference and real-world image processing script
├── Sesiunea_36_TensorFlow_Fundamente/
│   └── fundamente.py                 # Multi-Layer Perceptron (MLP) blueprint & Tensors
├── Sesiunea_37_CNN/
│   └── cnn_mnist.py                  # Spatial feature extraction on matrix datasets
├── Sesiunea_38_Transfer_Learning/
│   └── transfer_learning.py          # MobileNetV2 architecture freezing & customization
├── FLOW_INVATARE.md                  # Comprehensive lifecycle of deep learning models
├── GLOSAR_TERMENI.md                 # Complete AI dictionary (Tensor through Overfitting)
├── pyproject.toml                    # Modern declarative metadata for the project
└── README.md                         # This technical documentation file

🛠️ Core Engineering Decisions

1. Ecosystem Optimization via uv

Instead of legacy tools like venv, pip-tools, or .env configuration files, this workspace is managed strictly via uv. This ensures:

  • Blazing Fast Restores: Virtual environments are instantiated up to 100x faster using hardlinks.
  • Deterministic Locking: Dependencies (tensorflow, matplotlib, numpy) are strictly tracked inside pyproject.toml.

2. Keras 3 Native Compliance

To prevent runtime warnings (UserWarning: Do not pass an input_shape...) and future-proof the codebase against depreciation, all models explicitly use the tf.keras.layers.Input(shape=...) layer as the root entry point of Sequential instances.

3. Static Code Analysis Integration (Pylance Setup)

TensorFlow heavily relies on dynamic module loading, which breaks standard static analysis. This repository implements specific fallback paths inside .vscode/settings.json, mapping extraPaths to point directly to the local .venv site-packages. This removes misleading red squiggly import lines.

4. Advanced Production Serialization (.keras vs .h5)

Models are exported utilizing the modern, zipped-archive .keras native format. This solves tracking discrepancies for custom layers, ensures higher security compared to legacy pickle-based configurations, and compresses binary weight distribution.


🚀 Execution & Verification Pipelines

Make sure you are standing in the workspace root directory (Cap.8 TensorFlow/) before running commands.

1. Training Phase (CNN Pipeline)

Trains a robust Convolutional Neural Network on the Fashion-MNIST dataset (60,000 clothing matrices across 10 distinct classes). The script integrates a Dropout(0.3) layer to stabilize variance and mitigate validation overfitting.

uv run Proiect_Final_TensorFlow/train_project.py
  • Expected Output: Execution log tracks 5 training epochs. It will generate a performance chart at .assets/images/curba_invatare.png and serialize the neural brain at .assets/saved_models/model_fashion.keras.
  • Benchmark Target: Evaluates with a test dataset accuracy threshold exceeding 90%.

2. Production Inference Phase (Real-World Predictions)

Simulates production deployment by consuming the serialized network model to perform structural image classification.

uv run Proiect_Final_TensorFlow/predict.py
  • Fallback Mode: If no hardware or local files are found, the script generates an automatic digital noise matrix (np.random.rand) to prevent fatal script crashes.
  • Real Image Validation:
    1. Save any .jpg or .png picture of a piece of clothing (e.g., a shoe, bag, or shirt).
    2. Rename it to proba.jpg.
    3. Place it inside the .assets/images/ directory.
    4. Re-run the script. It will automatically load the file, downscale it to a 28x28 single-channel grayscale structure, and predict the exact article class with its mathematical probability!

📝 Learning Materials Included

  • GLOSAR_TERMENI.md: Explains all mathematical concepts (ReLU, Softmax, Categorical Crossentropy, Optimizer parameters) used in the code.
  • FLOW_INVATARE.md: Outlines the standard engineering workflow from data raw pre-processing up to model inference.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages