ISAT.widgets package

Submodules

ISAT.widgets.about_dialog module

class ISAT.widgets.about_dialog.AboutDialog(parent)

Bases: QDialog, Ui_Dialog

ISAT.widgets.annos_dock_widget module

class ISAT.widgets.annos_dock_widget.AnnosDockWidget(mainwindow)

Bases: QWidget, Ui_Form

Annotations dock widget.

mainwindow

main window

Type:

ISAT.widgets.mainwindow.MainWindow

polygon_item_dict

polygon and QListWidgetItem dict. {polygon: item}

Type:

dict

right_button_menu(point)
generate_item_and_itemwidget(polygon)

The item of annotations list widget.

Parameters:

polygon (Polygon) – polygon

Return type:

(<class ‘PyQt5.QtWidgets.QListWidgetItem’>, <class ‘PyQt5.QtWidgets.QWidget’>)

update_listwidget()

Update the annotations list widget.

update_combobox_group_select()
listwidget_add_polygon(polygon)

Add a new item to the list widget.

Parameters:

polygon (Polygon) – polygon

listwidget_remove_polygon(polygon)

Remove a item from the list widget.

Parameters:

polygon (Polygon) – polygon

set_selected(polygon)

Set item selected.

Parameters:

polygon (Polygon) –

set_polygon_selected()

Set polygon selected on canvas.

set_polygon_show(polygon)

Set polygon visible.

Parameters:

polygon (Polygon) – polygon

set_all_polygon_visible(visible=None)

Set all polygon visible.

Parameters:

visible (bool) – visible flag

set_all_polygon_lock(locked=None)
Parameters:

locked (bool | None) –

set_group_polygon_visible()

Set group polygon visible.

The group is self.comboBox_group_select.currentText()

zoom_to_group()

Zoom to suitable size of group.

go_to_next_group()

Show next group.

go_to_prev_group()

Show previous group.

ISAT.widgets.annos_validator_dialog module

class ISAT.widgets.annos_validator_dialog.AnnosValidatorDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

open_dir()
validate()

ISAT.widgets.auto_segment_dialog module

class ISAT.widgets.auto_segment_dialog.AutoSegmentThread(mainwindow)

Bases: QThread

message

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

run(self)
class ISAT.widgets.auto_segment_dialog.AutoSegmentDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

open_dir()
start()
cancel()
print_message(index, all, message)
init_connect()

ISAT.widgets.canvas module

class ISAT.widgets.canvas.AnnotationScene(mainwindow)

Bases: QGraphicsScene

Annotation Scene.

Parameters:

mainwindow (ISAT.widgets.mainwindow.MainWindow) – ISAT main window

image_item

Image pixmap item.

Type:

QtWidgets.QGraphicsPixmapItem

mask_item

SAM mask pixmap item.

Type:

QtWidgets.QGraphicsPixmapItem

image_data

Image data.

Type:

np.ndarray

current_graph

The polygon being annotated.

Type:

Polygon

prompt_box_item

The box for SAM box prompt.

Type:

Rect

repaint_line_item

The line for repaint mode.

Type:

Line

mode

STATUSMode. eg: CREATE, VIEW, EDIT, REPAINT.

Type:

STATUSMode

draw_mode

draw mode.eg:POLYGON, SEGMENTANYTHING_POINT, SEGMENTANYTHING_BOX

Type:

ISAT.configs.DRAWMode

contour_mode

The mode for convert sam mask to polygon.

Type:

CONTOURMode

prompt_point_positions

The click points for sam point prompt.

Type:

list

prompt_point_labels

The tag for sam point prompt.

Type:

list

prompt_point_items

The prompt points for sam point prompt.

Type:

list[PromptPoint, …]

mask

The mask output by sam model.

Type:

np.ndarray

mask_alpha

The alpha value for the mask.

Type:

float

guide_line_x

The guideline.

Type:

QtWidgets.QGraphicsLineItem

guide_line_y

The guideline.

Type:

QtWidgets.QGraphicsLineItem

last_draw_time

Counter for the dragging annotation method, used by draw polygon and repaint.

draw_interval

Interval for the dragging annotation method.

Type:

float

pressed

The tag for mouse pressed.

Type:

bool

selected_polygons_list

The list of polygons selected.

Type:

list

repaint_start_vertex

The start vertex for repaint.

Type:

Vertex

repaint_end_vertex

The end vertex for repaint.

Type:

Vertex

hovered_vertex

The hovered vertex for repaint.

Type:

Vertex

load_image(image_path)

Load image.

Parameters:

image_path (str) – The image path.

Returns:

unload_image()

Unload image and clear scene.

change_mode_to_create()

Change to create mode.

change_mode_to_view()

Change to view mode.

change_mode_to_edit()

Change to edit mode.

change_mode_to_repaint()

Change to repaint mode.

change_contour_mode_to_save_all()

Change to save all contour mode for convert mask to polygons.

change_contour_mode_to_save_max_only()

Change to save max contour mode for convert mask to polygons.

change_contour_mode_to_save_external()

Change to save external contour mode for convert mask to polygons.

change_contour_method_to_simple()
change_contour_method_to_tc89_kcos()
change_contour_method_to_none()
start_segment_anything()

Start segmenting anything with point prompt.

start_segment_anything_box()

Start segmenting anything with box prompt.

start_segment_anything_visual(positive=True)

Start segmenting anything with visual prompt.

Parameters:

positive (bool) –

start_draw_polygon()

Start drawing polygon.

start_draw()

Try change to create mode and add a empty polygon for annotation ops.

finish_draw()

Finish annotation. Convert mask to polygons when using sam, if the number of vertices less than 3, delete polygon.

cancel_draw()

Cancel draw. Remove the drawing polygons and masks, prompt points, prompt box eg.

delete_selected_graph()

Delete selected graph. Graph can be polygons or vertices, support multiple selection modes by pressing the CTRL key.

edit_polygon()

Edit the selected polygon. Open edit window then edit the attributes of the polygon.

move_polygon_to_top()

Move the selected polygon to top layer.

move_polygon_to_bottom()

Move the selected polygon to bottom layer.

copy_item()

Copy selected polygon. The copied polygon has the sam attributes with ori polygon.

polygons_union()

Union. Only support two polygons. Always use the attributes of the first polygon.

polygons_difference()

Subtract. Only support two polygons. Always use the attributes of the first polygon.

polygons_intersection()

Intersect. Only support two polygons. Always use the attributes of the first polygon.

polygons_symmetric_difference()

Exclude. Only support two polygons. Always use the attributes of the first polygon.

mousePressEvent(self, event: QGraphicsSceneMouseEvent | None)
Parameters:

event (QGraphicsSceneMouseEvent) –

mouseReleaseEvent(self, event: QGraphicsSceneMouseEvent | None)
Parameters:

event (QGraphicsSceneMouseEvent) –

mouseMoveEvent(self, event: QGraphicsSceneMouseEvent | None)
Parameters:

event (QGraphicsSceneMouseEvent) –

update_mask()

Update the mask output of sam.

backspace()

Backspace to the previous annotation state. Only work with create mode.

class ISAT.widgets.canvas.AnnotationView(parent=None)

Bases: QGraphicsView

keyPressEvent(self, event: QKeyEvent | None)
keyReleaseEvent(self, event: QKeyEvent | None)
wheelEvent(self, event: QWheelEvent | None)
Parameters:

event (QWheelEvent) –

zoom_in()
zoom_out()
zoomfit()
zoom(factor, point=None)
horizontal_scroll(angle)
vertical_scroll(angle)

ISAT.widgets.category_dock_widget module

class ISAT.widgets.category_dock_widget.CategoriesDockWidget(mainwindow)

Bases: QWidget, Ui_Form

choice_category()

Shortcut function for category choice.

update_widget()

Update list widget.

radio_choice(index)

Triggered when radio button selected and set current category.

Parameters:

index (int) – Index of list widget item.

item_choice(item)

Triggered when an item in the category list is clicked.Will trigger radio button.

Parameters:

item (QListWidgetItem) – Item to be checked.

update_current_group(text)

Update the current_group variable when the text in the QLineEdit changes.

Parameters:

text (str) – The text of QLineEdit.

increase_current_group()

Increase the current_group variable and update the QLineEdit text

decrease_current_group()

Decrease the current_group variable and update the QLineEdit text

toggle_group_mode()

Toggle group mode.

  • auto: Group id auto add 1 when add a new polygon.

  • manual: Manual set group id.

  • track: Group id changed with the group of current polygons when use [TAB] or [`] to check.

ISAT.widgets.category_edit_dialog module

class ISAT.widgets.category_edit_dialog.CategoryEditDialog(parent, mainwindow, scene)

Bases: QDialog, Ui_Dialog

check_category_enabled(checked)
check_group_enabled(checked)
check_note_enabled(checked)
check_crowded_enabled(checked)
load_cfg()

Load the cfg and update the interface.

get_category(item)

Triggered when category item selected.

Parameters:

item (QListWidgetItem) – category item.

apply()

Set attributes of polygon.

cancel()
closeEvent(self, a0: QCloseEvent | None)
Parameters:

a0 (QCloseEvent) –

reject(self)

ISAT.widgets.category_setting_dialog module

class ISAT.widgets.category_setting_dialog.CategorySettingDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

get_item_and_widget(category, color)

Return item and item widget for given category and color.

Parameters:
  • category (str) – category name

  • color (str) – color name

Returns:

The item of category list widget and the widget of the item.

Return type:

(<class ‘PyQt5.QtWidgets.QListWidgetItem’>, <class ‘PyQt5.QtWidgets.QWidget’>)

remove_category_item()

Remove category item.

load_cfg()

Load the cfg and update the interface.

add_new_category()

Add a new category item.

choice_color()

Triggered by color button. Select a new color for the category.

import_cfg()

Import cfg from yaml file.

export_cfg()

Export cfg to yaml file.

apply()

Apply setting of categories.

cancel()
init_connect()

ISAT.widgets.converter_dialog module

class ISAT.widgets.converter_dialog.Converter

Bases: QThread, ISAT

message

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

run(self)
load_from_isat()
convert_to_isat()
class ISAT.widgets.converter_dialog.COCOConverter

Bases: Converter, COCO

run(self)
coco_to_isat()
isat_to_coco()
class ISAT.widgets.converter_dialog.YOLOConverter

Bases: Converter, YOLO

run(self)
yolo_to_isat()
isat_to_yolo()
class ISAT.widgets.converter_dialog.LABELMEConverter

Bases: Converter, LABELME

run(self)
labelme_to_isat()
isat_to_labelme()
class ISAT.widgets.converter_dialog.VOCConverter

Bases: Converter, VOC

run(self)
isat_to_voc()
class ISAT.widgets.converter_dialog.VOCConverterForDetection

Bases: Converter, VOCDetect

run(self)
isat_to_voc_for_detection()
class ISAT.widgets.converter_dialog.ConverterDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

tab_widget_current_changed()
apply()
cancel()
open_file()
save_file()
open_dir()
save_dir()
print_message(index, all, message)
init_connect()

ISAT.widgets.files_dock_widget module

class ISAT.widgets.files_dock_widget.FilesDockWidget(mainwindow)

Bases: QWidget, Ui_Form

update_widget()

Update the file list widget.

set_select(row)

Set the current file highlight.

listwidget_doubleclick()

Double-click the file list item to open the image.

dragEnterEvent(self, a0: QDragEnterEvent | None)
dropEvent(event)

Support drop event for open a image file or image directory.

ISAT.widgets.info_dock_widget module

class ISAT.widgets.info_dock_widget.InfoDockWidget(mainwindow)

Bases: QWidget, Ui_Form

note_changed()

Add a note for current image.

update_widget()

Update the information dock widget.

ISAT.widgets.mainwindow module

class ISAT.widgets.mainwindow.QtBoxStyleProgressBar

Bases: QProgressBar

ISAT.widgets.mainwindow.calculate_area(points)

Calculate the area of an array of points.

Parameters:

points (list) – Vertices of polygon. [(x1, y1), (x2, y2), …]

Returns:

The area of the polygon.

Return type:

float

class ISAT.widgets.mainwindow.SegAnyThread(mainwindow)

Bases: QThread

Thread for encoder of the SAM model.

Parameters:

mainwindow (ISAT.widgets.mainwindow.MainWindow) – Get attributes and functions from mainwindow.

tag

Signal.

Type:

pyqtSignal

results_dict

Dictionary of results. {image_index: {“feature”: np.ndarray or tensor, …}, …}

Type:

dict

index

Current image index.

tag

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sam_encoder(image)

SAM encoder.

Parameters:

image (ndarray) – Image to be encoded.

run(self)
class ISAT.widgets.mainwindow.SegAnyVideoThread(mainwindow)

Bases: QThread

Thread for video segmentation of the SAM model.

Parameters:

mainwindow (ISAT.widgets.mainwindow.MainWindow) – Get attributes and functions from mainwindow.

tag

Signal.

Type:

pyqtSignal

start_frame_idx

The index of the start frame of the video.

Type:

int

max_frame_num_to_track

The maximum number of frames to track.

Type:

int

tag

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

run(self)
class ISAT.widgets.mainwindow.InitSegAnyThread(mainwindow)

Bases: QThread

Thread for init SAM model.

Parameters:

mainwindow (ISAT.widgets.mainwindow.MainWindow) – Get attributes and functions from mainwindow.

tag

Signal.

Type:

pyqtSignal

model_path

Checkpoint file path.

tag

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

run(self)
class ISAT.widgets.mainwindow.CheckLatestVersionThread(mainwindow)

Bases: QThread

Thread for checking latest version.

Parameters:

mainwindow (ISAT.widgets.mainwindow.MainWindow) – Get attributes and functions from mainwindow.

tag

Signal.

Type:

pyqtSignal

tag

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

run(self)
class ISAT.widgets.mainwindow.MainWindow

Bases: QMainWindow, Ui_MainWindow

The main window of ISAT, also contains most of the core functions.

image_root

Image root.

Type:

str

label_root

Label root.

Type:

str

files_list

List of images names.

Type:

list

current_index

Current index for current image in files_list.

Type:

int

current_group

Recode the current group. Default is 1.

Type:

int

config_file

Categories config file path. Default is ISAT/isat.yaml.

Type:

str

software_config_file

Software config file path. Default is ISAT/software.yaml.

Type:

str

saved

The state of whether the annotations are written to disk.

Type:

bool

can_be_annotated

The state of whether the annotation can be annotated. The png image with palette be used for VOC format, these can’t be annotated.

Type:

bool

load_finished

The state of whether the image load finished.

Type:

bool

polygons

List of polygons. These will be saved to disk as annotations.

Type:

list

instance_cmap

The color array. (N, 3), numpy.uint8

Type:

np.ndarray

map_mode

The map mode, means the current displayed state in the scene, which include ‘LABEL’, ‘SEMANTIC’ and ‘INSTANCE’.

Type:

MAPMode

current_label

The current annotation.

Type:

Annotation

use_segment_anything

The state of whether the SAM model can be used.

Type:

bool

use_segment_anything_video

The state of whether the SAM model can be used to video segmentation.

Type:

bool

use_remote_sam

The state of whether the remote sam is being used.

Type:

bool

group_select_mode

The mode of group. Default is ‘auto’.

Type:

bool

init_segment_anything(model_path=None, checked=True)

Initialize segment anything model.

Parameters:
  • model_path (str) – The path of the checkpoint file.

  • checked (bool) – If not checked, skip.

init_sam_finish(sam_tag, sam_video_tag)

Triggered when SAM finish is finished. Then start thread of sam encoder and video segmentation.

Warning

Do not call this function manually

Parameters:
  • sam_tag (bool) – The state of whether SAM can be used.

  • sam_video_tag (bool) – The state of whether video segmentation can be used.

sam_encoder_finish(index, state, message)

Triggered when sam encoder is finished.

Warning

Do not call this function manually

Parameters:
  • index (int) – The index of image.

  • state (int) – The state of sam encoder result. 0 - delete; 1 - success; 2 - working; 3 - error.

  • message (str) – Error message.

SeganyEnabled()

If current image has cached feature map by SAM encoder thread, enable semi-automatic annotation.

seg_video_start(max_frame_num_to_track=None)

Start video segmentation.

Parameters:

max_frame_num_to_track (int) – The maximum number of frames to track. Default: None, all frames.

seg_video_finish(current, total, finished, is_error, message)

Triggered when video segmentation finished.

Warning

Do not call this function manually

Parameters:
  • current (int) – The index of current frame to segmentation.

  • total (int) – The total number of frames.

  • finished (bool) – The state of whether current frame is finished.

  • is_error (bool) – The state of whether current frame error.

  • message (str) – Error message.current, total, finished, is_error, message. int, int, bool, bool, str

predict_current_image_with_text_prompt(prompt=None)
Parameters:

prompt (str | None) –

predict_current_image_with_visual_prompt(visual_category, boxes, labels)
Parameters:
  • visual_category (str) –

  • boxes (list) –

  • labels (list) –

mask_to_polygon(mask)
Parameters:

mask (ndarray) –

init_ui()
statusbar_change_status(is_message=True)
Parameters:

is_message (bool) –

translate(language='zh')
Parameters:

language (str) –

change_language()
reload_cfg()
load_actions_shortcut(default=False)

Load shortcut

Parameters:

default (bool) – load default shortcut if True.

set_saved_state(is_saved)
Parameters:

is_saved (bool) –

open_dir()

Open image root. Update file list and show the first image.

Tip

The label root will set same as the image root.

If exist ‘isat.yaml’ under label root, will reload it.

save_dir()

Open label root.

save()

Save annotations to disk.

update_group_display()
show_image(index, zoomfit=True)

Show image and load annotations if exists.

Parameters:
  • index (int) – Index of image.

  • zoomfit (bool) – Zoomfit.

prev_image()

Previous image.

next_image()

Next image.

jump_to(index_or_name=None)

Jump to the image.

Parameters:

index_or_name (str) – Index or name of the image. Index in (1, len(self.files_list)); name with suffix.

category_setting()
change_bit_map_to_semantic()
change_bit_map_to_instance()
change_bit_map_to_label()
change_bit_map()

Change the map mode, means the current displayed state in the scene.

LABEL -> SEMANTIC -> INSTANCE -> LABEL -> SEMANTIC -> ….

set_labels_visible(visible=None)

Set polygons visible in scene.

Parameters:

visible (bool) – True or False

model_manage()

Open the model management interface.

remote_sam()

Open the remote SAM model interface.

change_bfloat16_state(check_state)

Change SAM model dtype. bfloat16 <=> float32.

Parameters:

check_state (CheckState) –

change_use_video_segmentation_state(check_state)
Parameters:

check_state (CheckState) –

change_contour_mode(contour_mode='max_only')

Change contour mode. It has an effect when converting sam mask to polygons.

Parameters:

contour_mode (str) – contour mode. which include ‘max_only’ ‘external’ and ‘all’.

change_contour_method(contour_method='SIMPLE')
Parameters:

contour_method (str) –

change_mask_alpha(value)

Change mask alpha.

Parameters:

value (int) – mask alpha. [0, 10]

change_polygon_alpha_hover(value)
Parameters:

value (int) –

change_polygon_alpha_no_hover(value)
Parameters:

value (int) –

change_vertex_size(value)

Change vertex size.

Parameters:

value (int) – vertex size. [0, 5]

change_auto_save_state(check_state)
Parameters:

check_state (CheckState) –

change_real_time_area_state(check_state)

Change real time area state.

Tip

The area of the polygon can be viewed in the edit interface.(double click polygon to open.)

Parameters:

check_state (CheckState) –

change_edge_state(check_state)

Show edge of polygons.

Parameters:

check_state (CheckState) –

change_approx_polygon_state(check_state)

Change polygon state. It has an effect when converting sam mask to polygons, can reduce the number of vertices of the polygon.

Parameters:

check_state (CheckState) –

change_create_mode_invisible_polygon_state(check_state)

Invisible polygons in the create mode.

Parameters:

check_state (CheckState) –

change_saturation(value)

Only acts on display, don’t acts on SAM model.

Parameters:

value (int) –

change_prompt_visiable(check_state)

Show SAM propmt point.

Parameters:

check_state (CheckState) –

converter()

Open data converter interface.

video2frames()

Open video to farames interface. Split the video to frames.

auto_segment()

Open auto segment interface. Convert object detection data to segment data.

annos_validator()
process_exif()

Open process exif interface. Deal with the rotation problem of pictures with EXIF tags.

shortcut()

Open shortcut interface.

about()

Open about interface.

setting()

Open setting interface.

screen_shot(type='scene')

Screenshot.

Parameters:

type (str) – ‘scene’ or ‘window’

save_cfg(config_file)

Save categories config to disk.

Parameters:

config_file (str) – Path to config file.

save_software_cfg()

Save all config to disk.

open_docs()

Open the docs.

exit()
closeEvent(self, a0: QCloseEvent | None)
Parameters:

a0 (QCloseEvent) –

latest_version_tip(is_latest_version, latest_version)

Check whether it is the latest version.

Parameters:
  • is_latest_version (bool) – Whether it is the latest version.

  • latest_version (str) – The latest version.

static create_desktop_shortcut()
init_connect()
reset_action()

ISAT.widgets.model_manager_dialog module

class ISAT.widgets.model_manager_dialog.DownloadThread(parent=None)

Bases: QThread

Thread for downloading checkpoint.

urls

Url list, which include: ‘huggingface’ and ‘modelscope’.

Type:

list

name

Checkpoint name.

Type:

str

pause

Pause download.

Type:

bool

tag

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

setNameAndUrl(name, urls)
run(self)
move_from_tmp(from_path, to_path)
class ISAT.widgets.model_manager_dialog.ModelManagerDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

Model manager interface.

init_ui()
update_ui()
download(model_name)
download_process(button, model_name, downloaded_size, total_size)
Parameters:

button (QPushButton) –

pause(model_name)
delete(model_name)
clear_tmp()
static open_checkpoint_dir(self)
load_fine_tuned_model()
use_fine_tune_model()

ISAT.widgets.plugin_base module

class ISAT.widgets.plugin_base.PluginBase

Bases: ABC

Base class for all plugins.

abstract init_plugin(mainwindow)

Be used to plugin initialization.

s
Arguments:

mainwindow (MainWindow): Get attributes and functions from mainwindow.

abstract enable_plugin()

Enable plugin

abstract disable_plugin()

Disable plugin

abstract get_plugin_author()

Get plugin author.

Returns:

Plugin author.

Return type:

str

abstract get_plugin_version()

Get plugin version.

Returns:

Plugin version.

Return type:

str

abstract get_plugin_description()

Get plugin description.

Returns:

Plugin description.

Return type:

str

get_plugin_name()

Get plugin name.

Returns:

Plugin name. Default is the plugin class name.

Return type:

str

activate_state_changed(checkbox_state)
before_image_open_event(image_path)

当图片打开前调用

Parameters:

image_path (str) – The path of the image.

after_image_open_event()

当图片打开后调用

before_annotation_start_event()

当开始标注前调用

after_annotation_created_event()

当标注创建完成后调用

after_annotation_changed_event()

当标注发生变化后调用,包括创建新标注,拖动顶点,移动多边形,改变多边形属性等

before_annotations_save_event()

当保存标注文件前调用

after_annotations_saved_event()

当保存标注文件后调用

after_sam_encode_finished_event(index)

当sam编码完成后调用 注意ISAT在单独线程对前后图像进行预编码,通过self.mainwindow.seganythread.results_dict中获取编码结果

Parameters:

index (int) – Index of the image which has been encoded.

on_mouse_move_event(scene_pos)

当鼠标移动时调用

Parameters:

scene_pos (QtCore.QPointF) – 坐标,限制在图像范围内

on_mouse_press_event(scene_pos)

当鼠标按下时调用

Parameters:

scene_pos (QtCore.QPointF) – 坐标,限制在图像范围内

on_mouse_release_event(scene_pos)

当鼠标释放时调用

Parameters:

scene_pos (QtCore.QPointF) – 坐标,限制在图像范围内

on_mouse_pressed_and_mouse_move_event(scene_pos)

当鼠标拖动时调用

Parameters:

scene_pos (QtCore.QPointF) – 坐标,限制在图像范围内

application_start_event()

软件启动后触发

application_shutdown_event()

软件关闭前触发

ISAT.widgets.plugin_manager_dialog module

class ISAT.widgets.plugin_manager_dialog.PluginManagerDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

Plugin manager interface, also include most of all functions of plugin.

load_plugins()
update_gui()
trigger_before_image_open(image_path)
trigger_after_image_open()
trigger_before_annotation_start()
trigger_after_annotation_created()
trigger_after_annotation_changed()
trigger_before_annotations_save()
trigger_after_annotations_saved()
trigger_after_sam_encode_finished(index)
Parameters:

index (int) –

trigger_on_mouse_move(scene_pos)
Parameters:

scene_pos (QPointF) –

trigger_on_mouse_release(scene_pos)
Parameters:

scene_pos (QPointF) –

trigger_on_mouse_press(scene_pos)
Parameters:

scene_pos (QPointF) –

trigger_on_mouse_pressed_and_mouse_move(scene_pos)
Parameters:

scene_pos (QPointF) –

trigger_application_start()
trigger_application_shutdown()

ISAT.widgets.polygon module

class ISAT.widgets.polygon.PromptPoint(pos, type=0)

Bases: QGraphicsPathItem

SAM prompt point.

class ISAT.widgets.polygon.Vertex(polygon, color, nohover_size=2)

Bases: QGraphicsPathItem

Vertex of polygon.

setColor(color)
itemChange(self, change: QGraphicsItem.GraphicsItemChange, value: Any) Any
Parameters:
  • change (GraphicsItemChange) –

  • value (Any) –

hoverEnterEvent(self, event: QGraphicsSceneHoverEvent | None)
Parameters:

event (QGraphicsSceneHoverEvent) –

hoverLeaveEvent(self, event: QGraphicsSceneHoverEvent | None)
Parameters:

event (QGraphicsSceneHoverEvent) –

class ISAT.widgets.polygon.Polygon

Bases: QGraphicsPolygonItem

Polygon.

line_width

The width of the edge.

Type:

int

hover_alpha

The alpha value of the polygon when hovering.

Type:

int

nohover_alpha

the alpha value of the polygon when nohovering.

Type:

int

points

Record the point pos of the polygon.

Type:

list

vertices

Record the vertices of the polygon.

Type:

list[Vertex]

is_drawing

The flag to indicate if the polygon is drawing.

Type:

bool

category

The category of the polygon.

Type:

str

group

The group of the polygon.

Type:

int

iscrowd

The flag to indicate if the polygon is crowd.

Type:

bool

note

The note of the polygon.

Type:

str

area

The area of the polygon.

Type:

float

addPoint(point)

Add a vertex to the polygon.

Parameters:

point (QtCore.QPointF) – The vertex to add.

movePoint(index, point)

Move the point at the given index to the given point. The point is saved in self.points.

Parameters:
  • index (int) – The index of the vertex to move.

  • point (QtCore.QPointF) – The point to move to.

removePoint(index)

Remove a vertex from the polygon.

Parameters:

index (int) – The index of the vertex to remove.

delete()

Delete the polygon.

moveVertex(index, point)

Move the vertex at the given index to the given point. The vertex is saved in self.vertices.

Parameters:
  • index (int) – The index of the vertex to move.

  • point (QtCore.QPointF) – The point to move to.

itemChange(self, change: QGraphicsItem.GraphicsItemChange, value: Any) Any
Parameters:
  • change (QGraphicsItem.GraphicsItemChange) –

  • value (Any) –

hoverEnterEvent(self, event: QGraphicsSceneHoverEvent | None)
Parameters:

event (QGraphicsSceneHoverEvent) –

hoverLeaveEvent(self, event: QGraphicsSceneHoverEvent | None)
Parameters:

event (QGraphicsSceneHoverEvent) –

mouseDoubleClickEvent(self, event: QGraphicsSceneMouseEvent | None)
Parameters:

event (QGraphicsSceneMouseEvent) –

redraw()
change_color(color)
Parameters:

color (QColor) –

set_drawed(category, group, iscrowd, note, color, layer=None)

Set attributes for polygon and set is_drawing attribute to False.

Parameters:
  • category (str) – category of the polygon.

  • group (int) – group of the polygon.

  • iscrowd (bool) – whether the polygon is crowd.

  • note (str) – note of the polygon.

  • color (QColor) – color of the polygon.

  • layer (int | None) – layer of the polygon in scene.

calculate_area()

calculate area of polygon

Return type:

float

load_object(obj)

load attributes from Object of Annotation.

Parameters:

obj (Object) – Object of Annotation.

to_object()

Convert to Object of Annotation.

Return type:

Object

class ISAT.widgets.polygon.LineVertex(line, color, nohover_size=2)

Bases: QGraphicsPathItem

The vertex of a Line for repaint mode.

itemChange(self, change: QGraphicsItem.GraphicsItemChange, value: Any) Any
Parameters:
  • change (GraphicsItemChange) –

  • value (Any) –

class ISAT.widgets.polygon.Line

Bases: QGraphicsPathItem

The guideline for repaint mode.

addPoint(point)
movePoint(index, point)
removePoint(index)
delete()
redraw()
class ISAT.widgets.polygon.RectVertex(rect, color, nohover_size=2)

Bases: QGraphicsPathItem

The vertex of the prompt rect for sam box prompt.

itemChange(self, change: QGraphicsItem.GraphicsItemChange, value: Any) Any
Parameters:
  • change (GraphicsItemChange) –

  • value (Any) –

class ISAT.widgets.polygon.Rect

Bases: QGraphicsRectItem

The prompt rect for sam box prompt.

addPoint(point)
movePoint(index, point)
removePoint(index)
delete()
redraw()

ISAT.widgets.process_exif_dialog module

class ISAT.widgets.process_exif_dialog.ProcessExifDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

open_dir()
start()

ISAT.widgets.remote_sam_dialog module

class ISAT.widgets.remote_sam_dialog.RemoteSamDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

check_connection()
use_remote_sam(check_state)
class ISAT.widgets.remote_sam_dialog.IPv4Validator

Bases: QValidator

validate(self, a0: str | None, a1: int)

ISAT.widgets.right_button_menu module

class ISAT.widgets.right_button_menu.RightButtonMenu(mainwindow)

Bases: QMenu

ISAT.widgets.setting_dialog module

class ISAT.widgets.setting_dialog.SettingDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

contour_mode_index_changed(index)
contour_method_index_changed(index)

ISAT.widgets.shortcut_dialog module

class ISAT.widgets.shortcut_dialog.ShortcutDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

update_ui()
reset_shortcut()
shortcut_change_finish(action)

ISAT.widgets.switch_button module

class ISAT.widgets.switch_button.SwitchBtn(parent=None)

Bases: QWidget

checkedChanged

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

updateValue()
mousePressEvent(self, a0: QMouseEvent | None)
paintEvent(self, a0: QPaintEvent | None)
drawText(event, painter)
drawBg(event, painter)
drawSlider(event, painter)
setChecked(checked=False)

ISAT.widgets.text_prompt_dock_widget module

class ISAT.widgets.text_prompt_dock_widget.TextPromptDockWidget(mainwindow)

Bases: QWidget, Ui_Form

predict_for_single_category()
predict_for_multi_categories()

ISAT.widgets.video_to_frames_dialog module

class ISAT.widgets.video_to_frames_dialog.Video2FramesDialog(parent, mainwindow)

Bases: QDialog, Ui_Dialog

open_file()
open_dir()
start()

ISAT.widgets.visuall_prompt_dock_widget module

class ISAT.widgets.visuall_prompt_dock_widget.VisualPromptDockWidget(mainwindow)

Bases: QWidget, Ui_Form

Module contents