train_torchvision_resnet

train_torchvision_resnet

About

1.5.0
MIT

Training process for ResNet convolutional network.

Task: Classification
ResNet
classification
train

Train ResNet classification models.

Rock paper scissors

🚀 Use with Ikomia API

1. Install Ikomia API

We strongly recommend using a virtual environment. If you're not sure where to start, we offer a tutorial here.

pip install ikomia

2. Create your workflow

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()    

# Add dataset loader
data_loader = wf.add_task(name="dataset_classification")
data_loader.set_parameters({"dataset_folder": "path/to/dataset/folder"}) 

# Add train algorithm 
train = wf.add_task(name="train_torchvision_resnet", auto_connect=True)

# Launch your training on your data
wf.run()

☀️ Use with Ikomia Studio

Ikomia Studio offers a friendly UI with the same features as the API.

  • If you haven't started using Ikomia Studio yet, download and install it from this page.

  • For additional guidance on getting started with Ikomia Studio, check out this blog post.

📝 Set algorithm parameters

  • model_name (str) - default 'resnet18': Name of the pre-trained model. Other models available:

    • resnet34
    • resnet50
    • resnet101
    • resnet152
  • epochs (int) - default '15': Number of complete passes through the training dataset.

  • batch_size (int) - default '8': Number of samples processed before the model is updated.

  • learning_rate (float) - default '0.001': Step size at which the model's parameters are updated during training.

  • weight_decay (float) - default '1e-4': Amount of weight decay, regularization method.

  • momentum (float) - default '0.9: Optimization technique that accelerates convergence.

  • input_size (int) - default '224': Size of the input image.

  • export_pth (bool) - default 'True'

  • export_onnx (bool) - default 'False'

  • output_folder (str, optional): path to where the model will be saved.

  • num_workers (int) - default '0': How many parallel subprocesses you want to activate when you are loading all your data during your training or validation.

Parameters should be in strings format when added to the dictionary.

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()    

# Add dataset loader
data_loader = wf.add_task(name="dataset_classification")
data_loader.set_parameters({"dataset_folder": "path/to/dataset/folder"}) 

# Add train algorithm 
train = wf.add_task(name="train_torchvision_resnet", auto_connect=True)
train.set_parameters({
    "model_name": 'resnet18',
    "batch_size": "8",
    "epochs": "5",
    "input_size": "240",
    "momentum": "0.9",
    "learning_rate": "0.001",
    "weight_decay": "1e-4",
    "export_pth": "True",
    "export_onnx": "False",
}) 

# Launch your training on your data
wf.run()

Developer

  • Ikomia
    Ikomia

License

A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

PermissionsConditionsLimitations

Commercial use

License and copyright notice

Liability

Modification

Warranty

Distribution

Private use

This is not legal advice: this description is for informational purposes only and does not constitute the license itself. Provided by choosealicense.com.