A collection of PyTorch utilities for image AI training
Project description
Kevin's Torch Utils
這是一個用於圖像 AI 訓練的 PyTorch 工具組 (kevins_torch),旨在提供一系列實用的功能來簡化深度學習模型的開發、訓練和評估過程。
主要功能模組
models:base.py: 提供模型的基本結構。cnn.py: 包含通用的卷積神經網路實現。lenet.py: LeNet 模型的實現。pretrained.py: 處理和載入預訓練模型的工具。utils/activation_function_parser.py: 解析活化函數配置。
utils:load_parameters.py: 從設定檔載入模型和訓練參數。lightning_models.py: 與 PyTorch Lightning 整合的相關工具。logger_config.py: 設定日誌記錄器。repeat_channels.py: 用於調整輸入圖像通道數的工具。dataset/coffee_bean_dataset.py: 針對特定咖啡豆資料集的處理。
examples:settings.yaml: 範例設定檔。train_configs_generator.py: 產生訓練設定檔的腳本。
tests:- 包含對各個模組的單元測試。
安裝
您可以透過 pip 安裝此套件:
pip install kevins_torch
使用範例
import torch
from kevins_torch import models
from kevins_torch.utils import load_parameters
# 載入設定檔中的參數
config_path = 'examples/settings.yaml' # 假設您的設定檔路徑
params = load_parameters(config_path)
# 根據設定檔建立模型
# (假設您的設定檔中有模型定義)
# model = models.build_model(params['model_config']) # 實際函數可能不同
# 或者直接使用預定義的模型
model = models.LeNet(num_classes=10)
# 準備輸入數據 (範例)
dummy_input = torch.randn(1, 1, 28, 28) # LeNet 通常用於 MNIST (1x28x28)
# 進行預測
output = model(dummy_input)
print("模型輸出:", output.shape)
開發設定
如果您想為此專案貢獻,請先設定開發環境:
- 複製儲存庫:
git clone https://github.com/yourusername/kevins_torch # 請替換成實際的儲存庫 URL cd kevins_torch
- 安裝開發依賴:
pip install -r dev-requirements.txt
- 設定 pre-commit hooks (建議):
pre-commit install
執行測試
使用 pytest 執行測試:
pytest tests/
貢獻
歡迎透過 Pull Requests 或 Issues 提出問題和改進建議!
授權
本專案採用 MIT License 授權。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kevins_torch-0.2.2.tar.gz
(23.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kevins_torch-0.2.2.tar.gz.
File metadata
- Download URL: kevins_torch-0.2.2.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a7b13b127175e598bb9eb7ac563c86d4e84d9a3ea6ed0b103edd05f73324e09
|
|
| MD5 |
4cf83d959c7d4fe22649ef87c612810a
|
|
| BLAKE2b-256 |
bd74952409f8b5137faea0cca0d2856a06b07dd296e340e0428070ab4ac25368
|
File details
Details for the file kevins_torch-0.2.2-py3-none-any.whl.
File metadata
- Download URL: kevins_torch-0.2.2-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f6a75a94e1e9894836bdb709306b9648977eb51f0834860846922e91433b493
|
|
| MD5 |
9348554d23af10c0011f762c18e73e75
|
|
| BLAKE2b-256 |
b801ace8a027ac8342959d9f0f54d34d74b0c599cd54454eb40ffe2612e17d0b
|