Usage Sample
''''''''''''
.. code:: python
import torch
from torch import nn
from cvx2 import WidthBlock
from cvx2.wrapper import ImageClassModelWrapper
model = nn.Sequential(
WidthBlock(c1=1, c2=32),
nn.MaxPool2d(kernel_size=2, stride=2),
WidthBlock(c1=32, c2=64),
nn.MaxPool2d(kernel_size=2, stride=2),
nn.Flatten(),
nn.Linear(in_features=64*49, out_features=1024),
nn.Dropout(0.2),
nn.SiLU(inplace=True),
nn.Linear(in_features=1024, out_features=2),
)
img = torch.randn(1, 1, 28, 28)
print(model(img).shape)
data_dir
|__train
| |__class1
| | |__001.jpg
| | |__002.jpg
| |__class2
| |__001.jpg
| |__002.jpg
|__test
| |__class1
| | |__001.jpg
| | |__002.jpg
| |__class2
| |__001.jpg
| |__002.jpg
|__val
|__class1
| |__001.jpg
| |__002.jpg
|__class2
|__001.jpg
|__002.jpg
model_wrapper = ImageClassModelWrapper(model)
model_wrapper.train(data='data_dir', imgsz=28)
result = model_wrapper.predict('data_dir/test/class1/001.jpg', imgsz=28)
Raw data
{
"_id": null,
"home_page": "https://gitee.com/summry/cvx2",
"name": "CVX2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "CV, Computer Vision, Machine learning, Deep learning, torch",
"author": "summy",
"author_email": "xiazhongbiao@126.com",
"download_url": "https://files.pythonhosted.org/packages/ef/e4/93812e1746336f2eef09f24d4f56990de4bc3f6bfe6ec5d7d4962ebc8bc7/CVX2-0.1.3.tar.gz",
"platform": null,
"description": "Usage Sample\n''''''''''''\n\n.. code:: python\n\n import torch\n from torch import nn\n from cvx2 import WidthBlock\n from cvx2.wrapper import ImageClassModelWrapper\n\n model = nn.Sequential(\n WidthBlock(c1=1, c2=32),\n nn.MaxPool2d(kernel_size=2, stride=2),\n WidthBlock(c1=32, c2=64),\n nn.MaxPool2d(kernel_size=2, stride=2),\n nn.Flatten(),\n nn.Linear(in_features=64*49, out_features=1024),\n nn.Dropout(0.2),\n nn.SiLU(inplace=True),\n nn.Linear(in_features=1024, out_features=2),\n )\n\n img = torch.randn(1, 1, 28, 28)\n print(model(img).shape)\n\n data_dir\n |__train\n | |__class1\n | | |__001.jpg\n | | |__002.jpg\n | |__class2\n | |__001.jpg\n | |__002.jpg\n |__test\n | |__class1\n | | |__001.jpg\n | | |__002.jpg\n | |__class2\n | |__001.jpg\n | |__002.jpg\n |__val\n |__class1\n | |__001.jpg\n | |__002.jpg\n |__class2\n |__001.jpg\n |__002.jpg\n\n model_wrapper = ImageClassModelWrapper(model)\n model_wrapper.train(data='data_dir', imgsz=28)\n result = model_wrapper.predict('data_dir/test/class1/001.jpg', imgsz=28)\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Tools of CV(Computer Vision)",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://gitee.com/summry/cvx2"
},
"split_keywords": [
"cv",
" computer vision",
" machine learning",
" deep learning",
" torch"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "efe493812e1746336f2eef09f24d4f56990de4bc3f6bfe6ec5d7d4962ebc8bc7",
"md5": "1da46b319f3ec6373be32e1cedb03af1",
"sha256": "2b0ff038729fda3e274cc3a4c3461c09ce133bf911f27e978a544311c5ff5c90"
},
"downloads": -1,
"filename": "CVX2-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "1da46b319f3ec6373be32e1cedb03af1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 14755,
"upload_time": "2024-11-30T23:34:52",
"upload_time_iso_8601": "2024-11-30T23:34:52.487493Z",
"url": "https://files.pythonhosted.org/packages/ef/e4/93812e1746336f2eef09f24d4f56990de4bc3f6bfe6ec5d7d4962ebc8bc7/CVX2-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-30 23:34:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "cvx2"
}