pic_scanner.models.of_interest.factories

Attributes

LABEL_DESCRIPTIONS

dict:

VALID_LABELS

set:

Classes

OfInterest

A metaclass to enhance classes with logging capabilities. Classes that inherit from

Concern

A class detailing a NSFW concern (or 'detection') found on an image.

NonInteresting

A class detailing a non-interesting label found on an image.

InterestFactory

A InterestFactory that can be configured.

Module Contents

pic_scanner.models.of_interest.factories.LABEL_DESCRIPTIONS

dict: A dictionary that contains the labels and their descriptions.

The keys are the labels and the values are the descriptions.

pic_scanner.models.of_interest.factories.VALID_LABELS

set: A set of valid labels that can be used to classify images in the dataset.

class pic_scanner.models.of_interest.factories.OfInterest(name: str, score: float, location: list[int], description: str | None = None)

Bases: pic_scanner.log_engine.Loggable

A metaclass to enhance classes with logging capabilities. Classes that inherit from ‘Loggable’ can instantly access a logger without manually setting it up. This logger is derived from a parent logger, ensuring consistent logging behavior and hierarchy.

Parameters:
  • name (str)

  • score (float)

  • location (list[int])

  • description (Optional[str])

- log_device

The logger device associated with the instance of the class.

description
Return type:

Optional[str]

location
Return type:

list[int]

score
Return type:

float

name
Return type:

str

property score_percentage: float

Return the score of the concern as a percentage.

Returns:

The score of the concern as a percentage.

Return type:

float

property score: float

Return the score of the concern.

Returns:

The score of the concern.

Return type:

float

property score_percentage_str: str

Return the score of the concern as a percentage string.

Returns:

The score of the concern as a percentage string.

Return type:

str

property name: str

Return the name of the concern.

Returns:

The name of the concern.

Return type:

str

property description: str | None

Return the description of the concern.

Returns:

The description of the concern.

Return type:

Optional[str]

property location: list[int]

Return the location of the concern.

Returns:

The location of the concern.

Return type:

list[int]

class pic_scanner.models.of_interest.factories.Concern(name: str, score: float, location: list[int], description: str | None = None)

Bases: pic_scanner.models.of_interest.OfInterest

A class detailing a NSFW concern (or ‘detection’) found on an image.

Parameters:
  • name (str)

  • score (float)

  • location (list[int])

  • description (Optional[str])

name

The name of the concern.

Return type:

str

score

The score of the concern.

Return type:

float

location

The location of the concern.

Return type:

list[int]

description

The description of the concern.

Return type:

Optional[str]

class pic_scanner.models.of_interest.factories.NonInteresting(name: str, score: float, location: list[int], description: str = None)

Bases: pic_scanner.models.of_interest.Loggable, pic_scanner.models.of_interest.OfInterest

A class detailing a non-interesting label found on an image.

Parameters:
  • name (str)

  • score (float)

  • location (list[int])

  • description (str)

name

The name of the non-interesting label.

Return type:

str

score

The score of the non-interesting label.

Return type:

float

location

The location of the non-interesting label.

Return type:

list[int]

description

The description of the non-interesting label.

Return type:

Optional[str]

class pic_scanner.models.of_interest.factories.InterestFactory(all_non_interesting=False)

A InterestFactory that can be configured.

concerns

A list of labels that are concerning or might need special attention.

points_of_interest

A list of labels that are points of interest. All labels are points of interest until they are marked as concerning.

concerns = []
points_of_interest = []
non_interesting = []
mark(name, interest_level, case_sensitive=False)
make_concerning(name, case_sensitive=False)

Mark a label as concerning.

Parameters:
  • name (str) – The name of the label to mark as concerning.

  • case_sensitive (bool) – A flag indicating whether the label name should be treated as case-sensitive.

Returns:

None

make_non_interesting(name: str, case_sensitive=False)

Mark a label as non-interesting.

Parameters:

name (str) – The name of the label to mark as non-interesting.

Returns:

None

revert_to_point_of_interest(name)

Revert a label to a point of interest.

Parameters:

name (str) – The name of the label to revert to a point of interest.

Returns:

None

get_concerns()

Get the list of concerns.

Returns:

The list of concerns.

Return type:

list

get_non_interesting()

Get the list of non-interesting labels.

Returns:

The list of non-interesting labels.

Return type:

list

get_points_of_interest()

Get the list of points of interest.

Returns:

The list of points of interest.

Return type:

list

get_all_labels()

Get all labels.

Returns:

All labels.

Return type:

list

get_interest_dict()

Get a dictionary of all labels and their status.

Returns:

A dictionary of all labels and their status.

Return type:

dict

get_interest_dict_as_json()

Get a dictionary of all labels and their status as a JSON string.

Returns:

A JSON string of all labels and their status.

Return type:

str

create(name, **kwargs) pic_scanner.models.of_interest.OfInterest | pic_scanner.models.of_interest.concern.Concern | pic_scanner.models.of_interest.non_interesting.NonInteresting

Create a new OfInterest object.

Parameters:

name (str) – The name of the OfInterest object to create.

Returns:

The OfInterest object.

Return type:

OfInterest

remove_concerning(name, case_sensitive=False)
remove_non_interesting(name, case_sensitive=False)
move_from_points_of_interest(name, to)