ducho.internal.father_classes package

Submodules

ducho.internal.father_classes.FeatureExtractorFather module

class ducho.internal.father_classes.FeatureExtractorFather.FeatureExtractorFather(gpu='-1')[source]

Bases: object

Represents a feature extractor object.

This class provides functionality for feature extraction using various backend libraries and models.

_backend_libraries_list

A list of backend libraries (e.g. tensorflow, pytorch, etc.).

_model

The model for feature extraction.

_output_layer

The output layer for feature extraction.

_model_name

The name of the model.

_gpu

The GPU index or ‘-1’ for CPU.

Type:

str

_device

The device for computation (GPU, MPS, CPU).

extract_feature(image)[source]
set_framework(backend_libraries_list)[source]

Set the framework(s) for use (e.g. tensorflow, pytorch, etc.).

Parameters:

backend_libraries_list (List[str]) – A list of strings representing the framework(s) to utilize. It is acceptable to have only one item in the list.

Returns:

None

set_model(model_name)[source]
set_output_layer(output_layer)[source]

ducho.internal.father_classes.DatasetFather module

class ducho.internal.father_classes.DatasetFather.DatasetFather(input_directory_path, output_directory_path, model_name)[source]

Bases: object

Represents a dataset handler object.

This class provides functionality to manage dataset directories and filenames for data extraction.

_backend_libraries_list

A list of backend libraries (e.g. Tensorflow, Pytorch, Transformers)

_model_name

The name of the model.

Type:

str

_input_directory_path

The path to the input directory or a dictionary containing data paths.

Type:

str or dict

_output_directory_path

The path to the output directory, where the extraction will be saved.

Type:

str

create_output_file(input_batch, extracted_data, model_layer, fusion=None)[source]

Create an output numpy file with extracted data. (E.g. datasetFolder/framework/modelName/modelLayer/fileName.npy)

Parameters:
  • input_batch (tensor) – The batch just processed by the extractor. It contains the filenames too.

  • extracted_data (Any) – The data to be stored in the .npy file.

  • model_layer (str) – The name of the layer.

  • fusion (str, optional) – The type of fusion for multimodal models.

Returns:

None

set_framework(backend_libraries_list)[source]

Set the framework(s) to use.

Parameters:

backend_libraries_list (list of str) – A list of strings representing the framework(s) to use. It’s acceptable to have only one item in the list.

Returns:

None

set_model(model)[source]
abstract set_preprocessing_flag(preprocessing_flag)[source]

Module contents