Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/JonasSchatz/DepixHMM
/ functions
Functions
93 in github.com/JonasSchatz/DepixHMM
⨍
Functions
93
◇
Types & classes
36
↓ 7 callers
Function
create_training_data
Generates the data required for training the HMM.
text_depixelizer/training_pipeline/training_pipeline.py:15
↓ 6 callers
Function
get_overlap
(reconstructed_data: List[str], new_characters: Tuple[str, ...])
text_depixelizer/HMM/hmm_result_reconstructor.py:38
↓ 5 callers
Function
depix_hmm
(picture_parameters: PictureParameters, training_parameters: TrainingParameters, l
text_depixelizer/depix_hmm.py:20
↓ 5 callers
Function
generate_image_from_text
(text: str, options: ImageCreationOptions)
text_depixelizer/training_pipeline/original_image.py:42
↓ 5 callers
Function
pixelize_image
(original_image: OriginalImage, pixelization_options: PixelizationOptions)
text_depixelizer/training_pipeline/pixelized_image.py:43
↓ 5 callers
Method
train
(self)
text_depixelizer/HMM/depix_hmm.py:30
↓ 4 callers
Function
determine_number_of_tiles
(text_width, font_metrics, offset: Tuple[int, int], block_size: int)
text_depixelizer/training_pipeline/pixelized_image.py:25
↓ 4 callers
Method
test_image
Takes a pixelized image and reconstructs the hidden string
text_depixelizer/HMM/depix_hmm.py:80
↓ 3 callers
Function
determine_origin
(padding: Tuple[int, int], font_metrics: Tuple[int, int], offset: Tuple[int, int], block_size: int)
text_depixelizer/training_pipeline/pixelized_image.py:32
↓ 3 callers
Method
evaluate
Generates test data and checks it with the already trained model. Returns two values: - Accuracy: Percentage of correctly reconstruct
text_depixelizer/HMM/depix_hmm.py:119
↓ 3 callers
Method
log_viterbi
(self, sequence: List[Any])
text_depixelizer/HMM/hmm.py:70
↓ 3 callers
Function
reconstruct_string_from_window_characters
Reconstruct the string from the HMM results, e.g. [('a', 'b'), ('b', 'c')] -> 'abc'
text_depixelizer/HMM/hmm_result_reconstructor.py:6
↓ 3 callers
Method
viterbi
(self, sequence: List[Any])
text_depixelizer/HMM/hmm.py:49
↓ 2 callers
Method
calculate_hmm_properties
Takes a flattened list of windows to determine the probability matrices of the hidden markov model Note that the windows have to be c
text_depixelizer/HMM/depix_hmm.py:59
↓ 2 callers
Method
create_random_hmm
Returns a HMM object with random probabilities
test/HMM/test_hmm.py:11
↓ 2 callers
Function
create_windows_from_image
(original_image: OriginalImage, pixelized_image: PixelizedImage, window_options: WindowOptions)
text_depixelizer/training_pipeline/windows.py:32
↓ 2 callers
Function
depix_hmm_grid_search
(picture_parameters_grid_search: PictureParametersGridSearch, training_parameters_gr
text_depixelizer/depix_hmm.py:43
↓ 2 callers
Function
generate_character_bounding_boxes
Calculate the bounding boxes for every character. Source: https://github.com/python-pillow/Pillow/issues/3921
text_depixelizer/training_pipeline/original_image.py:56
↓ 2 callers
Method
generate_text
(self)
text_depixelizer/training_pipeline/text_generator.py:19
↓ 2 callers
Function
init_logging
(logging_parameters: LoggingParameters)
text_depixelizer/depix_hmm.py:14
↓ 2 callers
Function
interval_overlap
Calculate the overlap between two intervals Example: a=(10, 30) and b=(20, 40) gives an overlap of 10
text_depixelizer/training_pipeline/windows.py:24
↓ 2 callers
Function
pixelize_area
Pixelize an area of an image, given the parameters
text_depixelizer/training_pipeline/pixelized_image.py:73
↓ 2 callers
Method
test_cluster_indices
(self, indices: List[int])
text_depixelizer/HMM/depix_hmm.py:113
↓ 1 callers
Function
create_random_mosaic
Create an image of size img_size that consists of blocks of size block_size. It is assured that all blocks have a different color
test/utils.py:11
↓ 1 callers
Function
draw_character_bounding_boxes
Return a copy of an original image with the character bounding boxes drawn onto it for visualization
text_depixelizer/training_pipeline/original_image.py:76
↓ 1 callers
Function
generate_original_images
Given a list of texts and a font, generate images with that text and font Padding will be added around the text to allow space for pixelizati
text_depixelizer/training_pipeline/training_pipeline.py:56
↓ 1 callers
Function
generate_pixelized_images
Pixelizes the original images with the given block_size. By default, the pixelization is in line with the baseline of the text and the right
text_depixelizer/training_pipeline/training_pipeline.py:84
↓ 1 callers
Method
generate_text
(self)
text_depixelizer/training_pipeline/text_generator.py:28
↓ 1 callers
Function
generate_texts
Generates n_img strings that follow the given regex pattern
text_depixelizer/training_pipeline/training_pipeline.py:40
↓ 1 callers
Function
generate_windows
Generates the windows from the pixelized images. Note: The information from the original images is also needed, since we need to infer the ch
text_depixelizer/training_pipeline/training_pipeline.py:112
↓ 1 callers
Function
get_average_color
(img: Image)
text_depixelizer/training_pipeline/pixelized_image.py:39
↓ 1 callers
Method
get_emission_probabilities
Calculate the probability that state X emits symbol Y and save the (row-wise) normalized sum in emission_probabilities[X, Y]
text_depixelizer/HMM/depix_hmm.py:189
↓ 1 callers
Method
get_starting_probabilities
Calculate the probability of starting in state X
text_depixelizer/HMM/depix_hmm.py:151
↓ 1 callers
Method
get_transition_probabilities
From the given windows, count how many times state X follows state Y and save the (row-wise) normalized sum in transition_probabiliti
text_depixelizer/HMM/depix_hmm.py:162
↓ 1 callers
Function
levenshteinDistance
https://stackoverflow.com/questions/2460177/edit-distance-in-python
text_depixelizer/HMM/hmm_result_reconstructor.py:54
↓ 1 callers
Method
map_values_to_cluster
(self, values: List[np.array])
text_depixelizer/HMM/clusterer.py:18
↓ 1 callers
Method
map_values_to_cluster
(self, values: List[np.array])
text_depixelizer/HMM/clusterer.py:36
↓ 1 callers
Method
map_windows_to_cluster
(self, windows: List[Window])
text_depixelizer/HMM/clusterer.py:14
↓ 1 callers
Method
map_windows_to_cluster
(self, windows: List[Window])
text_depixelizer/HMM/clusterer.py:30
↓ 1 callers
Method
print_states
(self)
text_depixelizer/HMM/depix_hmm.py:206
↓ 1 callers
Function
string_similarity
Modified edit distance, normalizing the Levenshtein distance between 0 and 1, where 1 indicates a perfect match of the recovered string to th
text_depixelizer/HMM/hmm_result_reconstructor.py:46
↓ 1 callers
Method
test_windows
Takes a list of clustered windows and returns the most likely sequence of characters
text_depixelizer/HMM/depix_hmm.py:106
Method
__init__
(self, picture_parameters: PictureParameters, training_parameters: TrainingParameters)
text_depixelizer/HMM/depix_hmm.py:26
Method
__init__
(self, windows: List[Window], k: int)
text_depixelizer/HMM/clusterer.py:24
Method
__init__
(self, pattern: str)
text_depixelizer/training_pipeline/text_generator.py:16
Method
__init__
(self, text_length: int)
text_depixelizer/training_pipeline/text_generator.py:25
Function
create_image
(text: str, padding: Tuple[int, int] = (30, 30), font_size: int = 50)
test/utils.py:36
Method
font_metrics
(self)
text_depixelizer/training_pipeline/original_image.py:37
Method
generate_text
(self)
text_depixelizer/training_pipeline/text_generator.py:10
Method
log_emission_probabilities
(self)
text_depixelizer/HMM/hmm.py:30
Method
log_starting_probabilities
(self)
text_depixelizer/HMM/hmm.py:22
Method
log_transition_probabilities
(self)
text_depixelizer/HMM/hmm.py:26
Function
show_font_metrics
(picture_parameters: PictureParameters)
text_depixelizer/preprocessing.py:11
Method
test_bank_account_experiment_original
Repeating the experiments from Ch. 3.3 of the original publication. It is one of the simplest tasks: Redacted text consists of exactl
experiments/experiment_bank_account_numbers.py:13
Method
test_check_overlap_complete
(self)
test/HMM/test_hmm_result_reconstructor.py:47
Method
test_check_overlap_empty_reconstructed_data
(self)
test/HMM/test_hmm_result_reconstructor.py:83
Method
test_check_overlap_no_overlap
(self)
test/HMM/test_hmm_result_reconstructor.py:71
Method
test_check_overlap_partial
(self)
test/HMM/test_hmm_result_reconstructor.py:59
Method
test_check_overlap_partially_empty_reconstructed_data
(self)
test/HMM/test_hmm_result_reconstructor.py:95
Method
test_compare_viterbi_and_log
Regular viterbi and log-viterbi should return the same values (for shorter sequences)
test/HMM/test_hmm.py:81
Method
test_create_image
(self)
test/training_pipeline/test_original_image.py:18
Method
test_create_training_data
(self)
test/training_pipeline/test_training_pipeline.py:11
Method
test_create_training_data_random_offset
(self)
test/training_pipeline/test_training_pipeline.py:33
Method
test_depix_hmm_grid_search
(self)
test/test_depix_hmm.py:14
Method
test_determine_number_of_tiles_no_offset
(self)
test/training_pipeline/test_pixelize_image.py:20
Method
test_determine_number_of_tiles_y_offset_large
(self)
test/training_pipeline/test_pixelize_image.py:46
Method
test_determine_number_of_tiles_y_offset_small
(self)
test/training_pipeline/test_pixelize_image.py:33
Method
test_determine_origin_no_offset
(self)
test/training_pipeline/test_pixelize_image.py:59
Method
test_determine_origin_y_offset_small
(self)
test/training_pipeline/test_pixelize_image.py:72
Method
test_draw_character_bounding_boxes
(self)
test/training_pipeline/test_original_image.py:47
Method
test_evaluate
(self)
test/HMM/test_depix_hmm.py:36
Method
test_generate_character_bounding_boxes
(self)
test/training_pipeline/test_original_image.py:31
Method
test_generate_sample_images
(self)
experiments/experiment_generate_sample_images.py:14
Method
test_get_starting_probabilities
(self)
test/HMM/test_depix_hmm.py:50
Method
test_increasing_sample_images
(self)
experiments/experiment_accuracy.py:13
Method
test_interval_overlap
(self)
test/training_pipeline/test_windows.py:12
Method
test_issue_001
(self)
experiments/issue_001/experiment_issue_001.py:15
Method
test_kmeans_fit
(self)
test/HMM/test_clusterer.py:10
Method
test_number_text_generator
(self)
test/training_pipeline/test_text_generator.py:22
Method
test_pixelize_image
(self)
test/training_pipeline/test_pixelize_image.py:85
Method
test_pixelize_image_correct_offset
(self)
test/training_pipeline/test_pixelize_image.py:101
Method
test_randomize_offset_x
(self)
test/training_pipeline/test_pixelize_image.py:119
Method
test_randomize_offset_y
(self)
test/training_pipeline/test_pixelize_image.py:137
Method
test_reconstruct_string_from_window_characters_seven_duplicates
(self)
test/HMM/test_hmm_result_reconstructor.py:29
Method
test_reconstruct_string_from_window_characters_two_duplicates
(self)
test/HMM/test_hmm_result_reconstructor.py:11
Method
test_regex_text_generator_digits
(self)
test/training_pipeline/test_text_generator.py:8
Method
test_test_image
(self)
test/HMM/test_depix_hmm.py:86
Method
test_train
(self)
test/HMM/test_depix_hmm.py:23
Method
test_viterbi
(self)
test/HMM/test_hmm.py:38
Method
test_viterbi_fail_for_numerical_underflow
When the observation sequence gets too long, the regular viterbi will fail due to numerical underflow
test/HMM/test_hmm.py:57
Method
test_window_creation
(self)
test/training_pipeline/test_windows.py:30
Method
text_size
(self)
text_depixelizer/training_pipeline/original_image.py:33
Method
validate_attributes
(self)
text_depixelizer/HMM/hmm.py:33