Tools of CV(Computer Vision)
Project description
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)
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
CVX2-0.1.3.tar.gz
(14.8 kB
view details)
File details
Details for the file CVX2-0.1.3.tar.gz
.
File metadata
- Download URL: CVX2-0.1.3.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b0ff038729fda3e274cc3a4c3461c09ce133bf911f27e978a544311c5ff5c90 |
|
MD5 | 1da46b319f3ec6373be32e1cedb03af1 |
|
BLAKE2b-256 | efe493812e1746336f2eef09f24d4f56990de4bc3f6bfe6ec5d7d4962ebc8bc7 |