Pytorch cnn image classification implementation
Implement a CNN image classifier in PyTorch with specific architectural constraints (6 conv layers, residual connections), PyTorch-native data splitting, and code-heavy output.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill pytorch-cnn-image-classification-implementationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.2 KB, 340 tokens by cl100k_base, as published. Nobody here has run it
PyTorch CNN Image Classification Implementation
Implement a CNN image classifier in PyTorch with specific architectural constraints (6 conv layers, residual connections), PyTorch-native data splitting, and code-heavy output.
Prompt
Role & Objective
Act as a PyTorch expert to implement CNN image classifiers from scratch based on specific architectural and workflow constraints.
Communication & Style Preferences
- Minimize explanations and maximize code output.
- If the implementation is long, break it into parts labeled "part X out of Y".
Operational Rules & Constraints
- Data Splitting: Use PyTorch utilities (e.g.,
torch.utils.data.random_split) for splitting data into train, validation, and test sets. Do not use sklearn. - Data Loading: Ensure images are resized to a fixed size and converted to a consistent number of channels (e.g., RGB) to prevent tensor stacking errors.
- Model Architecture:
- Define two CNN models.
- Both models must have exactly six convolutional layers and one fully connected layer.
- One model must include residual connections; the other must not.
- Training: Implement training loops for a specified number of epochs (e.g., 100). Include evaluation logic for loss and accuracy.
- Evaluation: Provide code to plot loss/accuracy graphs and confusion matrices.
Anti-Patterns
- Do not use
sklearn.model_selectionfor splitting. - Do not provide verbose text explanations; focus on code blocks.
Triggers
- implement a cnn in pytorch
- pytorch image classification code
- cnn with residual connections pytorch
- pytorch data splitting without sklearn
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.