SebasLopez-ai's picture
Transfer Learning Update: Synchronized models and added comparative documentation
5d7a83f
In software development and data science, creating a src (short for source) folder is a widespread best practice for organizing a project.
Looking at your current CIFAR-10 image classification project, here is why you and most developers put core Python files (like
data_loader.py
,
model_builder.py
, etc.) into a src/ directory:
1. Separation of Concerns
A real-world project has many different types of files:
Documentation:
README.md
,
REPORT.md
Environment settings:
requirements.txt
,
.gitignore
Exploration & Presentation: Jupyter Notebooks (in your notebooks_knowledge&presentation/ folder)
User Interface/App: Streamlit or Flask code (in your app/ folder)
The Core Logic: The actual python scripts that do the heavy lifting.
By placing the core logic inside the src/ folder, you perfectly separate the "engine" of your project from the documentation, the UI, and the configuration.
2. Modularity and Reusability (Easy Importing)
By having a src/ folder (with an init.py file inside), Python treats it as a module. This means you can easily reuse the exact same code in different places without copying and pasting.
For example, whether you are experimenting in a Jupyter Notebook or running your web interface in
app/app.py
, you can effortlessly use your data loader like this:
python
from src.data_loader import load_data
from src.model_builder import build_model
This is much cleaner than defining standard functions repeatedly in different notebooks.
3. A Clean Root Directory
Without a src/ folder, your root project directory would be flooded with python files:
train.py
,
evaluate.py
,
data_loader.py
, app.py, mixed alongside
requirements.txt
and .git. By storing them in src/, your root directory stays clean and easy to read for any other developer (or yourself in the future) who lands on your project's GitHub page.
4. Preventing Import Conflicts (The src Layout)
In standard Python packaging, using a src layout forces you to test your code exactly how it will be imported by others. It prevents accidental import errors that can happen when your application code is sitting right next to your top-level scripts.
Summary:
You create src/ to house the core "engine" of your machine learning workflow (loading data, building models, training, evaluating), allowing you to easily import those functions into both your Jupyter Notebooks and your app.py while keeping your workspace organized!