CosSIF: Cosine Similarity-based Image Filtering
Project description
CosSIF: Cosine Similarity-based Image Filtering
Suppose we are presented with two categories of skin lesions: benign and malignant. Our objective is to sift out benign images that bear resemblance to malignant ones, and similarly, malignant images that bear resemblance to benign ones.
from cossif import cossif
csf = cossif.CosSIF()
# Filter benign images
csf.calculate_and_filter(
target_path=cls_benign, # Path to the folder that contains benign images.
secondary_path=cls_malignant, # Path to the folder that contains malignant images.
filtered_path=cls_benign_filtered, # Path to the folder that will contain filtered benign images.
removed_path=cls_benign_removed, # Path to the folder that will contain removed benign images.
record_save_path=save_path, # Save path of the similarity calculation record.
record_keep=False, # Chose whether to keep the similarity calculation record or not.
file_name='t_benign_x_s_malignant', # Name of the similarity calculation record file.
filter_type='dissimilar', # Type of filtering. Can be either "similar" or "dissimilar".
filter_range=0.85, # The filtering ratio. A value of 0.85 means that 15% of the images will be removed.
)
# Filter malignant images
csf.calculate_and_filter(
target_path = cls_malignant,
secondary_path = cls_benign,
filtered_path=cls_malignant_filtered,
removed_path=cls_malignant_removed,
record_save_path = save_path,
record_keep=False,
file_name = 't_malignant_x_s_benign',
filter_type = 'similar',
filter_range = 0.85,
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cossif-0.0.3.tar.gz
(6.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cossif-0.0.3.tar.gz.
File metadata
- Download URL: cossif-0.0.3.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d303ac9a270a2b5aeec8df2ae923d5174211006ddeeaf1545edd1cb80a5469e8
|
|
| MD5 |
30144b926024e5c37b47895af4108e4e
|
|
| BLAKE2b-256 |
af76ebe89484317993de10aba16cef277a0474ceb6a2c28ca7022724754b4070
|
File details
Details for the file cossif-0.0.3-py3-none-any.whl.
File metadata
- Download URL: cossif-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f75d99be3638405f52424ee9c07c1fee0d76b59a6cfa26d5d8373bd1f8c019c
|
|
| MD5 |
a53e85ed9539ebf41df2fd90223ac816
|
|
| BLAKE2b-256 |
9fd555c1f672f2cdefaa581517f1b5f1201d0e705b41bc2be64c4f3950c25588
|