Skip to main content

Tools of CV(Computer Vision)

Project description

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)

Project details


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.4.9.tar.gz (20.8 kB view details)

Uploaded Source

File details

Details for the file CVX2-0.4.9.tar.gz.

File metadata

  • Download URL: CVX2-0.4.9.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for CVX2-0.4.9.tar.gz
Algorithm Hash digest
SHA256 0dd20453a1da48f808832ddbd132f88b67a969cbcdac092f8c616ad29907e028
MD5 a86bb49009be89f7a9adff1fe5b8d249
BLAKE2b-256 52c244fa861236597b52f982c67fff72a2b97722cfcebee9e4a8d48d138d9321

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page