Skip to main content

Usage Sample ''''''''''''

.. code:: python

    from torch import nn
    from cvx2 import WidthBlock
    from cvx2.wrapper import ImageClassifyModelWrapper

    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),
    )

    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 = ImageClassifyModelWrapper(model)
    model_wrapper.train(data='data_dir', imgsz=28)
    result = model_wrapper.predict('data_dir/test/class1/001.jpg', imgsz=28)

Metadata

Release files for CVX2 0.6.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CVX2 0.6.6
File Size Uploaded Provenance Actions
cvx2-0.6.6.tar.gz 25.3 kB Without provenance Details for cvx2-0.6.6.tar.gz

Release files / cvx2-0.6.6.tar.gz

Download URL cvx2-0.6.6.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7cb9df2c8255af1758b15ed167b058184ba49c71203692d3bd3712780032b8e4
BLAKE2b-256 checksum
How to use checksums
6ffe5d15c992370ba426d336d250d82bcaa23565d2c7729d32b8e0fbce6c1b6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Security for CVX2 0.6.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.6 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page