-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
173 lines (145 loc) · 4.75 KB
/
Makefile
File metadata and controls
173 lines (145 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Makefile for Image Classifier Project
.PHONY: help install test train predict clean setup sample-data
# Default target
help:
@echo "Image Classifier Project - Available Commands:"
@echo ""
@echo "Setup:"
@echo " setup - Install dependencies and setup environment"
@echo " install - Install Python dependencies"
@echo " sample-data - Create sample dataset for testing"
@echo ""
@echo "Development:"
@echo " test - Run all tests"
@echo " test-unit - Run unit tests only"
@echo " lint - Run code linting"
@echo ""
@echo "Training:"
@echo " train - Train model with default settings"
@echo " train-sample - Train model with sample data"
@echo " train-custom - Train model with custom parameters"
@echo ""
@echo "Prediction:"
@echo " predict - Run prediction on sample image"
@echo ""
@echo "Maintenance:"
@echo " clean - Clean generated files"
@echo " clean-models - Remove saved models"
@echo " clean-data - Remove sample data"
# Setup commands
setup: install sample-data
@echo "Project setup complete!"
install:
@echo "Installing dependencies..."
pip install -r requirements.txt
@echo "Dependencies installed successfully!"
sample-data:
@echo "Creating sample dataset..."
python -c "from src.utils import create_sample_dataset; create_sample_dataset('data', num_samples=20)"
@echo "Sample dataset created in data/ directory"
# Development commands
test: test-unit
@echo "All tests completed!"
test-unit:
@echo "Running unit tests..."
python -m pytest tests/ -v
lint:
@echo "Running code linting..."
flake8 src/ tests/ examples/ --max-line-length=100 --ignore=E203,W503
@echo "Linting completed!"
# Training commands
train:
@echo "Training model with default settings..."
python scripts/run_training.py --create-sample --num-samples 50
train-sample:
@echo "Training model with sample data..."
python scripts/run_training.py --create-sample --num-samples 20 --epochs 10
train-custom:
@echo "Training model with custom parameters..."
python scripts/run_training.py --create-sample --epochs 30 --batch-size 16 --patience 5
# Prediction commands
predict:
@echo "Running prediction on sample image..."
python examples/predict_image.py
# Maintenance commands
clean:
@echo "Cleaning generated files..."
rm -rf __pycache__/
rm -rf src/__pycache__/
rm -rf tests/__pycache__/
rm -rf examples/__pycache__/
rm -f *.log
rm -f training_*.png
rm -f training_*.json
rm -f model_summary.txt
@echo "Cleanup completed!"
clean-models:
@echo "Removing saved models..."
rm -rf models/
@echo "Models removed!"
clean-data:
@echo "Removing sample data..."
rm -rf data/
@echo "Sample data removed!"
# Quick start for new users
quick-start: setup train predict
@echo "Quick start completed! Check the results above."
# Development workflow
dev-setup: install sample-data test
@echo "Development environment ready!"
# Production setup
prod-setup: install test
@echo "Production environment ready!"
# Help for specific commands
help-train:
@echo "Training Options:"
@echo " make train - Default training (50 samples, 20 epochs)"
@echo " make train-sample - Quick training (20 samples, 10 epochs)"
@echo " make train-custom - Custom training (30 epochs, batch size 16)"
@echo ""
@echo "Custom training parameters:"
@echo " python scripts/run_training.py --help"
help-predict:
@echo "Prediction Options:"
@echo " make predict - Predict on sample image"
@echo " python examples/predict_image.py - Interactive prediction"
@echo ""
@echo "For custom predictions, modify examples/predict_image.py"
# Documentation
docs:
@echo "Generating documentation..."
python -c "import src.image_classifier; help(src.image_classifier.ImageClassifier)"
@echo "Documentation generated!"
# Performance testing
benchmark:
@echo "Running performance benchmark..."
python -c "from src.utils import check_gpu_availability; check_gpu_availability()"
@echo "Benchmark completed!"
# Full project validation
validate: test lint
@echo "Project validation completed!"
# Release preparation
release: clean test lint
@echo "Release preparation completed!"
@echo "Ready for deployment!"
# Docker support (if needed)
docker-build:
@echo "Building Docker image..."
docker build -t image-classifier .
docker-run:
@echo "Running Docker container..."
docker run -it --rm -v $(PWD):/app image-classifier
# Windows-specific commands
windows-setup:
@echo "Setting up for Windows..."
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
@echo "Windows setup completed!"
# macOS/Linux-specific commands
unix-setup:
@echo "Setting up for Unix-like systems..."
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
@echo "Unix setup completed!"