hoops_ai.ml.EXPERIMENTAL.EmbeddingFlowModel
- class hoops_ai.ml.EXPERIMENTAL.EmbeddingFlowModel(result_dir=None, log_file='Embedding_model_training_errors.log', generate_stream_cache_for_visu=False, face_weight_mode='power', face_alpha=1.3, face_tau=2.0, face_mix_uniform=0.05, face_eps=1e-06, edge_weight_mode='power', edge_alpha=1.3, edge_tau=2.0, edge_mix_uniform=0.05, edge_eps=1e-06, use_face_type_onehot=True, face_type_num_classes=16, face_type_max=15, uv_channels=7, lr=0.0003, weight_decay=0.0, emb_dim=1024, proj_dim=512, surf_in_ch=23, curve_in_ch=6, proj_hidden=1024, use_bn=True, temp_init=0.05, temp_min=0.01, temp_max=0.2, surf_c=(32, 64, 128), curve_c=(32, 64, 128), conv_kernel=3, conv_pad=1, aug_noise_std=0.005, aug_scale_min=0.85, aug_scale_max=1.2, p_hflip=0.5, p_vflip=0.5, p_rot90=0.5, p_cutout=0.3, cutout_frac_min=0.08, cutout_frac_max=0.2, channel_jitter_std=0.005, curve_noise_std_xyz=0.005, curve_noise_std_other=0.003, curve_p_reverse=0.5, curve_p_dropout=0.04, curve_augment_smooth=False, node_weight_drop_prob=0.5, edge_weight_drop_prob=0.5, weight_beta_a=10.0, weight_beta_b=10.0, loss_type='hard', hard_pos_weight=2.0, hard_neg_weight=3.0, sc_weight=0.0, proj=False, load_checkpoint_using_nn_module=False)
Bases:
FlowModelFlowModel adapter so FlowTrainer can train embedding contrastive model.
- Parameters:
result_dir (str)
log_file (str)
generate_stream_cache_for_visu (bool)
face_weight_mode (str)
face_alpha (float)
face_tau (float)
face_mix_uniform (float)
face_eps (float)
edge_weight_mode (str)
edge_alpha (float)
edge_tau (float)
edge_mix_uniform (float)
edge_eps (float)
use_face_type_onehot (bool)
face_type_num_classes (int)
face_type_max (int)
uv_channels (int)
lr (float)
weight_decay (float)
emb_dim (int)
proj_dim (int)
surf_in_ch (int)
curve_in_ch (int)
proj_hidden (int)
use_bn (bool)
temp_init (float)
temp_min (float)
temp_max (float)
surf_c (tuple)
curve_c (tuple)
conv_kernel (int)
conv_pad (int)
aug_noise_std (float)
aug_scale_min (float)
aug_scale_max (float)
p_hflip (float)
p_vflip (float)
p_rot90 (float)
p_cutout (float)
cutout_frac_min (float)
cutout_frac_max (float)
channel_jitter_std (float)
curve_noise_std_xyz (float)
curve_noise_std_other (float)
curve_p_reverse (float)
curve_p_dropout (float)
curve_augment_smooth (bool)
node_weight_drop_prob (float)
edge_weight_drop_prob (float)
weight_beta_a (float)
weight_beta_b (float)
loss_type (str)
hard_pos_weight (float)
hard_neg_weight (float)
sc_weight (float)
proj (bool)
load_checkpoint_using_nn_module (bool)
- static build_body_filepath(filename, body_index, default_extension='.ml')
Build a filename with a body index suffix (e.g.
_0,_1).The suffix
_{body_index}is always appended to the stem of the filename. If filename has a file extension it is treated as a file path and the suffix is inserted before the extension. Otherwise the default_extension is appended after the suffix.
- convert_encoded_data_to_graph(storage, graph_handler, filename)
Converts encoded data from storage into a graph representation, which serves as input for the ML model.
- encode_cad_data(cad_file, cad_loader, storage)
Opens the CAD file and encodes its data into a format suitable for machine learning. Stores the encoded data using the provided storage handler.
- Parameters:
cad_file (str)
cad_loader (CADLoader)
storage (DataStorage)
- Return type:
- encode_label_data(label_storage, storage)
Uses the LabelStorage object to retrieve the labeling information for a given input Stores the label data for the specific machine learning Task
return the str key when the label data is found in the storage object and the size of the label data
- Parameters:
label_storage (LabelStorage)
storage (DataStorage)
- Return type:
- load_model_input_from_files(graph_file, data_id, label_file=None)
Loads the graph created in method convert_encoded_data_to_graph from a file. the return of this method is exactly the input as expected by the machine learning model the label_file is optional. If not given, the method should return a valid object.
This method will be called multiple times by the DatasetLoader. This method will be called with label_file == None for doing inference
- make_weights(a, mode='power', alpha=0.5, tau=2.0, mix_uniform=0.0, eps=1e-06)
- metrics()
Publish/push the ml metrics after training the model
- predict_and_postprocess(batch)
Post-processes and formats the raw model output into a structured prediction.
- Return type: