Skip to main content

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.
)

image_description

image_description

image_description

# 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,
)

image_description

image_description

image_description

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cossif-0.0.3-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

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

Hashes for cossif-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d303ac9a270a2b5aeec8df2ae923d5174211006ddeeaf1545edd1cb80a5469e8
MD5 30144b926024e5c37b47895af4108e4e
BLAKE2b-256 af76ebe89484317993de10aba16cef277a0474ceb6a2c28ca7022724754b4070

See more details on using hashes here.

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

Hashes for cossif-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1f75d99be3638405f52424ee9c07c1fee0d76b59a6cfa26d5d8373bd1f8c019c
MD5 a53e85ed9539ebf41df2fd90223ac816
BLAKE2b-256 9fd555c1f672f2cdefaa581517f1b5f1201d0e705b41bc2be64c4f3950c25588

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page