Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/branislav1991/PyTorchProjectFramework
/ functions
Functions
71 in github.com/branislav1991/PyTorchProjectFramework
⨍
Functions
71
◇
Types & classes
12
↓ 6 callers
Method
__init__
(self, in_ch, out_ch, bilinear=True)
models/segmentation_model.py:49
↓ 5 callers
Method
create_visdom_connections
If the program could not connect to Visdom server, this function will start a new server at the default port.
utils/visualizer.py:34
↓ 4 callers
Method
set_input
Unpack input data from the dataloader and perform necessary pre-processing steps. The implementation here is just a basic setting of input and
models/base_model.py:37
↓ 3 callers
Function
create_dataset
Create a dataset given the configuration (loaded from the json file). This function wraps the class CustomDatasetDataLoader. This is the
datasets/__init__.py:33
↓ 3 callers
Method
eval
Make models eval mode during test time.
models/base_model.py:88
↓ 3 callers
Method
post_epoch_callback
(self, epoch, visualizer)
models/base_model.py:207
↓ 3 callers
Method
pre_epoch_callback
(self, epoch)
models/base_model.py:203
↓ 2 callers
Method
backward
Calculate losses; called in every training iteration.
models/segmentation_model.py:147
↓ 2 callers
Function
create_model
Create a model given the configuration. This is the main interface between this package and train.py/validate.py
models/__init__.py:43
↓ 2 callers
Method
forward
Run forward pass; called by both functions <optimize_parameters> and <test>.
models/base_model.py:47
↓ 2 callers
Function
parse_configuration
Loads config file if a string was passed and returns the input if a dictionary was passed.
utils/__init__.py:22
↓ 2 callers
Method
setup
Load and print networks; create schedulers.
models/base_model.py:56
↓ 2 callers
Method
test
Forward function used in test time. This function wraps <forward> function in no_grad() so we don't save intermediate steps for backprop
models/base_model.py:95
↓ 2 callers
Function
transfer_to_device
Transfers pytorch tensors or lists of tensors to GPU. This function is recursive to be able to deal with lists of lists.
utils/__init__.py:10
↓ 1 callers
Method
export
Exports all the networks of the model using JIT tracing. Requires that the input is set.
models/base_model.py:218
↓ 1 callers
Function
find_dataset_using_name
Import the module "data/[dataset_name]_dataset.py". In the file, the class called DatasetNameDataset() will be instantiated. It has to be a s
datasets/__init__.py:10
↓ 1 callers
Function
find_model_using_name
Import the module "models/[model_name]_model.py". In the file, the class called DatasetNameModel() will be instantiated. It has to be
models/__init__.py:20
↓ 1 callers
Method
get_current_losses
Return traning losses / errors. train.py will print out these errors on console
models/base_model.py:194
↓ 1 callers
Method
get_custom_dataloader
Get a custom dataloader (e.g. for exporting the model). This dataloader may use different configurations than the default trai
datasets/__init__.py:70
↓ 1 callers
Method
get_hyperparam_result
Returns the final training result for hyperparameter tuning (e.g. best validation loss).
models/base_model.py:211
↓ 1 callers
Function
get_scheduler
Return a learning rate scheduler.
utils/__init__.py:33
↓ 1 callers
Method
load_data
(self)
datasets/__init__.py:66
↓ 1 callers
Method
load_networks
Load all the networks from the disk.
models/base_model.py:129
↓ 1 callers
Method
load_optimizers
Load all the optimizers from the disk.
models/base_model.py:157
↓ 1 callers
Method
optimize_parameters
Calculate losses, gradients, and update network weights; called in every training iteration
models/base_model.py:52
↓ 1 callers
Method
plot_current_losses
Display the current losses on visdom display: dictionary of error labels and values. Input params: epoch: Current epoch.
utils/visualizer.py:43
↓ 1 callers
Method
plot_current_validation_metrics
Display the current validation metrics on visdom display: dictionary of error labels and values. Input params: epoch: Current epo
utils/visualizer.py:71
↓ 1 callers
Method
print_current_losses
Print current losses on console. Input params: epoch: Current epoch. max_epochs: Maximum number of epochs.
utils/visualizer.py:137
↓ 1 callers
Method
print_networks
Print the total number of parameters in the network and network architecture.
models/base_model.py:170
↓ 1 callers
Method
reset
Reset the visualization.
utils/visualizer.py:28
↓ 1 callers
Method
save_networks
Save all the networks to the disk.
models/base_model.py:113
↓ 1 callers
Method
save_optimizers
Save all the optimizers to the disk for restarting training.
models/base_model.py:147
↓ 1 callers
Function
train
(config_file, export=True)
train.py:18
↓ 1 callers
Method
train
Make models train mode during test time.
models/base_model.py:81
↓ 1 callers
Method
update_learning_rate
Update learning rates for all the networks; called at the end of every epoch
models/base_model.py:104
↓ 1 callers
Function
validate
(config_file)
validate.py:15
Method
__getitem__
Return a data point (usually data and labels in a supervised setting).
datasets/base_dataset.py:26
Method
__getitem__
(self, index)
datasets/segmentation2d_dataset.py:16
Method
__init__
Initialize the Visualizer class. Input params: configuration -- stores all the configurations
utils/visualizer.py:12
Method
__init__
Initialize the class; save the configuration in the class.
datasets/base_dataset.py:15
Method
__init__
(self, configuration)
datasets/segmentation2d_dataset.py:12
Method
__init__
(self, configuration)
datasets/__init__.py:52
Method
__init__
Initialize the BaseModel class. Parameters: configuration: Configuration dictionary. When creating your custom class, yo
models/base_model.py:13
Method
__init__
(self, in_ch, out_ch)
models/segmentation_model.py:12
Method
__init__
(self, in_ch, out_ch)
models/segmentation_model.py:28
Method
__init__
(self, in_ch, out_ch)
models/segmentation_model.py:37
Method
__init__
(self, in_ch, out_ch)
models/segmentation_model.py:75
Method
__init__
(self, n_channels, n_classes)
models/segmentation_model.py:92
Method
__init__
Initialize the model.
models/segmentation_model.py:120
Method
__iter__
Return a batch of data.
datasets/__init__.py:89
Method
__len__
Return the total number of images in the dataset.
datasets/base_dataset.py:21
Method
__len__
(self)
datasets/segmentation2d_dataset.py:21
Method
__len__
Return the number of data in the dataset.
datasets/__init__.py:83
Method
forward
(self, x)
models/segmentation_model.py:23
Method
forward
(self, x)
models/segmentation_model.py:32
Method
forward
(self, x)
models/segmentation_model.py:44
Method
forward
(self, x1, x2)
models/segmentation_model.py:57
Method
forward
(self, x)
models/segmentation_model.py:79
Method
forward
(self, x)
models/segmentation_model.py:105
Method
forward
Run forward pass.
models/segmentation_model.py:141
Method
get_current_visuals
Return visualization images. train.py will display these images.
models/base_model.py:232
Function
get_transform
(opt, method=cv2.INTER_LINEAR)
datasets/base_dataset.py:43
Method
optimize_parameters
Calculate gradients and update network weights.
models/segmentation_model.py:153
Method
plot_roc_curve
Display the ROC curve. Input params: fpr: False positive rate (1 - specificity). tpr: True positive rate (sensitivity
utils/visualizer.py:98
Method
post_epoch_callback
Callback to be called after every epoch.
datasets/base_dataset.py:37
Method
post_epoch_callback
(self, epoch, visualizer)
models/segmentation_model.py:171
Method
pre_epoch_callback
Callback to be called before every epoch.
datasets/base_dataset.py:32
Method
set_requires_grad
Set requies_grad for all the networks to avoid unnecessary computations.
models/base_model.py:184
Method
show_validation_images
Display validation images. The images have to be in the form of a tensor with [(image, label, prediction), (image, label, prediction), ...] in
utils/visualizer.py:120
Function
stack_all
Stack all iterables of torch tensors in a list (i.e. [[(tensor), (tensor)], [(tensor), (tensor)]])
utils/__init__.py:43
Method
test
(self)
models/segmentation_model.py:162