mednet.models.classify.cnn3d¶
Simple 3D convolutional neural network architecture for classification.
Classes
|
Simple 3D convolutional neural network architecture for classification. |
- class mednet.models.classify.cnn3d.Conv3DNet(loss_type=<class 'torch.nn.modules.loss.BCEWithLogitsLoss'>, loss_arguments={}, optimizer_type=<class 'torch.optim.adam.Adam'>, optimizer_arguments={}, scheduler_type=None, scheduler_arguments={}, model_transforms=[], augmentation_transforms=[], num_classes=1)[source]¶
Bases:
Model
Simple 3D convolutional neural network architecture for classification.
This network has a linear output. You should use losses with
WithLogit
instead of cross-entropy versions when training.- Parameters:
The loss to be used for training and evaluation.
Warning
The loss should be set to always return batch averages (as opposed to the batch sum), as our logging system expects it so.
optimizer_type (
type
[Optimizer
]) – The type of optimizer to use for training.optimizer_arguments (
dict
[str
,Any
]) – Arguments to the optimizer afterparams
.scheduler_type (
type
[LRScheduler
] |None
) – The type of scheduler to use for training.scheduler_arguments (
dict
[str
,Any
]) – Arguments to the scheduler afterparams
.model_transforms (
Sequence
[Callable
[[Tensor
],Tensor
]]) – An optional sequence of torch modules containing transforms to be applied on the input before it is fed into the network.augmentation_transforms (
Sequence
[Callable
[[Tensor
],Tensor
]]) – An optional sequence of torch modules containing transforms to be applied on the input before it is fed into the network.num_classes (
int
) – Number of outputs (classes) for this model.
- property num_classes: int¶
Number of outputs (classes) for this model.
- Returns:
The number of outputs supported by this model.
- Return type:
- on_load_checkpoint(checkpoint)[source]¶
Perform actions during model loading (called by lightning).
If you saved something with on_save_checkpoint() this is your chance to restore this.
- Parameters:
checkpoint (
MutableMapping
[str
,Any
]) – The loaded checkpoint.- Return type:
- forward(x)[source]¶
Same as
torch.nn.Module.forward()
.- Parameters:
*args – Whatever you decide to pass into the forward method.
**kwargs – Keyword arguments are also possible.
- Returns:
Your model’s output