Skip to content

Paul Kumswa Submission - #5

Open
PaulKumswa wants to merge 16 commits into
Pixeptron-Vision:mainfrom
PaulKumswa:main
Open

Paul Kumswa Submission#5
PaulKumswa wants to merge 16 commits into
Pixeptron-Vision:mainfrom
PaulKumswa:main

Conversation

@PaulKumswa

Copy link
Copy Markdown

No description provided.

Copilot AI lite review requested due to automatic review settings August 9, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the missing scaffold sections for the steel surface defect classification final project, covering the end-to-end pipeline from data loading and preprocessing through model training, checkpointing, inference, and Streamlit UI display, plus adds MkDocs-based project documentation.

Changes:

  • Implemented CNN model definition, training/validation loops, and checkpoint saving.
  • Implemented dataset scanning/splitting and Albumentations preprocessing pipelines.
  • Added inference + Streamlit result wiring and introduced MkDocs configuration/docs content (plus a data prep script and a committed runtime log).

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
final_project/steel_defect/train.py Implements loss/optimizer setup, train/val epochs, and best-checkpoint saving.
final_project/steel_defect/preprocessing.py Adds training and validation Albumentations transform pipelines.
final_project/steel_defect/model.py Defines the SteelCNN architecture and forward pass.
final_project/steel_defect/inference.py Implements checkpoint loading and single-image prediction with class scores.
final_project/steel_defect/dataset.py Implements dataset directory scanning, stratified splits, and __getitem__.
final_project/steel_defect/app.py Wires inference results into the Streamlit “Prediction” stats panel.
final_project/requirements.txt Adds MkDocs dependencies.
final_project/mkdocs.yml Adds MkDocs site configuration for project docs.
final_project/logs/app.log Adds a generated application/training log file to the repo.
final_project/docs/index.md Adds a project writeup for MkDocs.
final_project/data_prep.py Adds a dataset reorganization/copy script for preparing class folders.
Suppressed comments (5)

final_project/steel_defect/preprocessing.py:80

  • Same as training transforms: this should use the shared IMAGE_SIZE constant rather than a hardcoded (256, 256) to stay consistent with the documented behavior and avoid future drift.
        A.Resize(256, 256),

final_project/docs/index.md:25

  • Spelling: “abou” → “about”.
Model info: It has abou 103k params, and convolutional blocks with 32, 64, and 128 output channels.

final_project/docs/index.md:29

  • Spelling: “onl” → “only”.
The training loop used a CrossEntropyLoss loss function, an Adam optimizer, learning rate of 0.001, and a batch size of 32. I used onl a CPU for training and the model ran for 20 epochs. 

final_project/docs/index.md:33

  • Spelling: “tranin gtime” → “training time”.
Total tranin gtime was about 4 hours for me, and epoch 17 had the best validation accuracy. My final validation accuracy was 0.791.

final_project/docs/index.md:37

  • Spelling/capitalization: “streamlitapp” → “Streamlit app”, and start the sentence with “My”.
I was able to run the application in streamlitapp, with about 60ms of inference time. my final model accuracy was 79.1%.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

# raise NotImplementedError("PREPROCESS-1: Implement training transforms")

return A.Compose([
A.Resize(256, 256),
Comment on lines +98 to +100
checkpoint = torch.load(self.checkpoint_path, map_location=self.device)
model = SteelCNN(num_classes=NUM_CLASSES)
model.load_state_dict(checkpoint["model_state_dict"])
Comment on lines +95 to +96
if not self.checkpoint_path.exists():
raise FileNotFoundError("No checkpoint found")
Comment on lines +193 to +196
loaded_image = cv2.imread(image_path)
if loaded_image is None:
raise FileNotFoundError("No image at filepath")
loaded_image = cv2.cvtColor(loaded_image, cv2.COLOR_BGR2RGB)

## Data Preprocessing

The preprocessing had traning and validation pipelines. All images were resized to 256x256. In order to augement training, images were given a random flip probability and also a random brightness contrast. The flip and brightness were not added to validation, for the sake of reproducibility.
Comment on lines +8 to +22
#create paths
project_root = Path(__file__).resolve().parent
raw_root = project_root / "data" / "severstal-steel-defect-detection"
csv_path = raw_root / "train.csv"
train_images_path = raw_root / "train_images"
steel_defect_path = project_root / "data" / "steel_defect"
print(project_root)
print(raw_root)
print(csv_path)

# loading csv
df = pd.read_csv(csv_path)
print(df.shape)
print(df.columns)
print(df.head())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants