domainlab.compos package

Subpackages

Submodules

domainlab.compos.a_nn_builder module

Integrate Chain-of-Responsibility and Builder Pattern for feature extract

class domainlab.compos.a_nn_builder.AbstractFeatExtractNNBuilderChainNode(successor_node)[source]

Bases: AbstractChainNodeHandler

to ensure chain of responsibility node AbstractChainNodeHandler always work even some node can not start their heavy weight business object, avoid override the initializer so that node construction is always light weight.

init_business(dim_out, args, i_c=None, i_h=None, i_w=None, flag_pretrain=None, remove_last_layer=False)[source]

initialize and return the heavy weight business object for doing the real job :param request: subclass can override request object to be string or function :return: the constructed service object

is_myjob(args)[source]
Parameters:

args_nname – command line arguments: “–nname”: name of the torchvision model “–npath”: path to the user specified python file with neural network definition

domainlab.compos.builder_nn_alex module

domainlab.compos.builder_nn_alex.mkNodeFeatExtractNNBuilderNameAlex(arg_name4net, arg_val)[source]

domainlab.compos.builder_nn_conv_bn_relu_2 module

domainlab.compos.builder_nn_conv_bn_relu_2.mkNodeFeatExtractNNBuilderNameConvBnRelu2(arg_name4net, arg_val, conv_stride)[source]

mkNodeFeatExtractNNBuilderNameConvBnRelu2. In chain of responsibility selection of neural network, reuse code to add more possibilities of neural network of the same family. :param arg_name4net: name of nn in args :param arg_val: the registered name of the neural network to be added :param conv_stride: should be 1 for 28*28 images :param i_c: :param i_h: :param i_w:

domainlab.compos.builder_nn_external_from_file module

domainlab.compos.builder_nn_external_from_file.mkNodeFeatExtractNNBuilderExternFromFile(arg_name_net_path)[source]

for each algorithm, there might exist different feature extractors, e.g. for diva, there can be class feature extractor and domain feature extractor

domainlab.compos.utils_conv_get_flat_dim module

domainlab.compos.utils_conv_get_flat_dim.get_flat_dim(module, i_channel, i_h, i_w, batchsize=5)[source]

flat the convolution layer output and get the flat dimension for fully connected network :param module: :param i_channel: :param i_h: :param i_w: :param batchsize:

domainlab.compos.zoo_nn module

class domainlab.compos.zoo_nn.FeatExtractNNBuilderChainNodeGetter(args, arg_name_of_net, arg_path_of_net)[source]

Bases: object

1. Hardcoded chain 3. Return selected node

Module contents