Skip to main content

A package of tools for building deep-learning classification programs.

Project description

wk-classify

A package of tools for building deep-learning classification programs. Easy to use, light and powerful.

Install

pip3 install wk-classify

Usage

Quick start

from wcf import train,  TrainValConfigBase
class Config(TrainValConfigBase):
    TRAIN_DIR = 'path for train set'
    VAL_DIR = 'path for val set'
cfg=Config()
train(cfg)

A real example

from wcf import train, TrainValConfigBase, val,t,EasyTransform,models_names
class Config(TrainValConfigBase):
    MODEL_TYPE = models_names.shufflenet_v2_x0_5
    TAG = '[%s]'%(MODEL_TYPE)
    GEN_CLASSES_FILE = True
    USE_tqdm_TRAIN = True
    INPUT_SIZE = (252,196) #(w,h)
    BATCH_SIZE = 64
    MAX_EPOCHS = 200
    BALANCE_CLASSES = True
    VAL_INTERVAL = 1
    WEIGHTS_SAVE_INTERVAL = 1
    WEIGHTS_INIT = 'weights/training/model_best.pkl'
    TRAIN_DIR = '/home/ars/sda5/data/projects/烟盒/data/现场采集好坏烟照片/相机1-train'
    VAL_DIR = '/home/ars/sda5/data/projects/烟盒/data/现场采集好坏烟照片/相机1-val'
    val_transform = EasyTransform([
        t.Resize(INPUT_SIZE[::-1]),
        t.SaveToDir('data/test'),
        t.ToTensor(),
    ])
    train_transform = EasyTransform([
        t.ColorJitter(brightness=0.2, contrast=0, saturation=0, hue=0),
        # t.RandomHorizontalFlip(),
        # t.RandomVerticalFlip(),
        # t.RandomRotate(360),
        t.RandomTranslate(30),
        t.RandomBlur(p=0.3, radius=1),
        t.RandomSPNoise(p=0.3),
        *val_transform,
    ])
    # def get_model(self, num_classes=None):
        # model=YourModel(...)
        # return model


if __name__ == '__main__':
    cfg = Config()
    train(cfg)
    # res=val(cfg)
    # print(res)

all options

see the TrainValConfigBase class for all options

how to predict?

see demo_predict.py

more

see demo_train.py and demo_predict.py

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

wk-classify-0.0.3.5.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

wk_classify-0.0.3.5-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file wk-classify-0.0.3.5.tar.gz.

File metadata

  • Download URL: wk-classify-0.0.3.5.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for wk-classify-0.0.3.5.tar.gz
Algorithm Hash digest
SHA256 5d0e92fadda9b9f71db35bdd1aceaddd4348c2ad2f69d29b61bd7521ae66270e
MD5 a57d878e0f667d818a9cf24ad5e001e8
BLAKE2b-256 57b108565928bb24c6991b6e154271b6544aa8190669f44817a362993adb0d8d

See more details on using hashes here.

File details

Details for the file wk_classify-0.0.3.5-py3-none-any.whl.

File metadata

  • Download URL: wk_classify-0.0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for wk_classify-0.0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4294fcd0b53e6dd45fc1fdb51d0b3fb438dc4141d1614accd6357eabb0f0dfb1
MD5 29eed51cf47a0b50c5eed62175373c78
BLAKE2b-256 8e1fcd1792e7d505d3d6607383ac6082e6981776957c2bba76512b7defc6df7a

See more details on using hashes here.

Supported by

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