ok-script 0.0.87__tar.gz → 0.0.88__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ok-script-0.0.87 → ok-script-0.0.88}/PKG-INFO +1 -1
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/adb/DeviceManager.py +1 -1
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/feature/FeatureSet.py +62 -62
- {ok-script-0.0.87 → ok-script-0.0.88}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.87 → ok-script-0.0.88}/setup.py +1 -1
- {ok-script-0.0.87 → ok-script-0.0.88}/README.md +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/OK.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/alas/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/alas/emulator_base.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/alas/emulator_windows.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/alas/platform_base.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/alas/platform_windows.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/alas/utils.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/BaseCaptureMethod.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/HwndWindow.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/adb/ADBCaptureMethod.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/adb/WindowsCaptureFactory.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/image/ImageCaptureMethod.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/image/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/BaseWindowsCaptureMethod.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/BitBltCaptureMethod.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/DesktopDuplicationCaptureMethod.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/color/Color.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/color/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/config/Config.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/config/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/feature/Box.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/feature/CompressCoco.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/firebase/Analytics.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/firebase/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/App.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/MainWindow.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/MessageWindow.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/StartController.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/about/HttpTextEdit.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/about/VersionCard.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/debug/LogWindow.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/resources.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/start/StartCard.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/EmptyCard.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/StartLoadingDialog.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/interaction/DoNothingInteraction.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/save/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/task/BaseTask.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/task/ExecutorOperation.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/task/TaskExecutor.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/task/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/update/GithubMultiDownloader.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/update/Updater.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/update/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/update/gen_md5.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/Handler.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/json.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/list.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/path.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/thread.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok/util/yaml.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/setup.cfg +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/tests/__init__.py +0 -0
- {ok-script-0.0.87 → ok-script-0.0.88}/tests/test_updater.py +0 -0
|
@@ -263,7 +263,7 @@ class DeviceManager:
|
|
|
263
263
|
self.use_windows_capture()
|
|
264
264
|
if not isinstance(self.interaction, Win32Interaction):
|
|
265
265
|
self.interaction = Win32Interaction(self.capture_method)
|
|
266
|
-
preferred['connected'] = self.capture_method.connected()
|
|
266
|
+
preferred['connected'] = self.capture_method is not None and self.capture_method.connected()
|
|
267
267
|
else:
|
|
268
268
|
width, height = self.get_resolution()
|
|
269
269
|
if self.config.get('capture') == "windows":
|
|
@@ -49,14 +49,15 @@ class FeatureSet:
|
|
|
49
49
|
self.lock = threading.Lock()
|
|
50
50
|
|
|
51
51
|
def check_size(self, frame):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
self.
|
|
52
|
+
with self.lock:
|
|
53
|
+
height, width = frame.shape[:2]
|
|
54
|
+
if self.width != width or self.height != height and height > 0 and width > 0:
|
|
55
|
+
logger.info(f"FeatureSet: Width and height changed from {self.width}x{self.height} to {width}x{height}")
|
|
56
|
+
self.width = width
|
|
57
|
+
self.height = height
|
|
58
|
+
self.process_data()
|
|
59
|
+
elif not self.feature_dict:
|
|
60
|
+
self.process_data()
|
|
60
61
|
|
|
61
62
|
def process_data(self) -> None:
|
|
62
63
|
"""
|
|
@@ -66,60 +67,59 @@ class FeatureSet:
|
|
|
66
67
|
width (int): Target width for scaling images.
|
|
67
68
|
height (int): Target height for scaling images.
|
|
68
69
|
"""
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
self.box_dict[category_name] = Box(x, y, w, h, name=category_name)
|
|
70
|
+
if self.debug:
|
|
71
|
+
folder_size = sum(os.path.getsize(os.path.join(dirpath, filename))
|
|
72
|
+
for dirpath, dirnames, filenames in os.walk(self.coco_folder)
|
|
73
|
+
for filename in filenames)
|
|
74
|
+
# Convert size to MB
|
|
75
|
+
folder_size_mb = folder_size / (1024 * 1024)
|
|
76
|
+
if folder_size_mb > 5:
|
|
77
|
+
from ok.feature.CompressCoco import compress_coco
|
|
78
|
+
logger.info(f'template folder greater than 5MB try to compress the COCO dataset')
|
|
79
|
+
compress_coco(self.coco_json)
|
|
80
|
+
self.feature_dict.clear()
|
|
81
|
+
self.box_dict.clear()
|
|
82
|
+
with open(self.coco_json, 'r') as file:
|
|
83
|
+
data = json.load(file)
|
|
84
|
+
|
|
85
|
+
# Create a map from image ID to file name
|
|
86
|
+
image_map = {image['id']: image['file_name'] for image in data['images']}
|
|
87
|
+
|
|
88
|
+
# Create a map from category ID to category name
|
|
89
|
+
category_map = {category['id']: category['name'] for category in data['categories']}
|
|
90
|
+
|
|
91
|
+
for annotation in data['annotations']:
|
|
92
|
+
image_id = annotation['image_id']
|
|
93
|
+
category_id = annotation['category_id']
|
|
94
|
+
bbox = annotation['bbox']
|
|
95
|
+
|
|
96
|
+
# Load and scale the image
|
|
97
|
+
image_path = str(os.path.join(self.coco_folder, image_map[image_id]))
|
|
98
|
+
image = cv2.imread(image_path)
|
|
99
|
+
_, original_width = image.shape[:2]
|
|
100
|
+
if image is None:
|
|
101
|
+
logger.error(f'Could not read image {image_path}')
|
|
102
|
+
continue
|
|
103
|
+
x, y, w, h = bbox
|
|
104
|
+
if self.width != image.shape[1] or self.height != image.shape[0]:
|
|
105
|
+
scale_x, scale_y = self.width / image.shape[1], self.height / image.shape[0]
|
|
106
|
+
logger.debug(f'scaling images {scale_x}, {scale_y}')
|
|
107
|
+
image = cv2.resize(image, (self.width, self.height))
|
|
108
|
+
# Calculate the scaled bounding box
|
|
109
|
+
x, y, w, h = x * scale_x, y * scale_y, w * scale_x, h * scale_y
|
|
110
|
+
|
|
111
|
+
# Crop the image to the bounding box
|
|
112
|
+
image = image[round(y):round(y + h), round(x):round(x + w), :3]
|
|
113
|
+
|
|
114
|
+
# Store in featureDict using the category name
|
|
115
|
+
category_name = category_map[category_id]
|
|
116
|
+
logger.debug(
|
|
117
|
+
f"loaded {category_name} resized width {self.width} / original_width:{original_width},scale_x:{self.width / original_width}")
|
|
118
|
+
if category_name in self.feature_dict:
|
|
119
|
+
raise ValueError(f"Multiple boxes found for category {category_name}")
|
|
120
|
+
if not category_name.startswith('box_'):
|
|
121
|
+
self.feature_dict[category_name] = Feature(image, x, y, w, h)
|
|
122
|
+
self.box_dict[category_name] = Box(x, y, w, h, name=category_name)
|
|
123
123
|
|
|
124
124
|
def get_box_by_name(self, mat, category_name: str) -> Box:
|
|
125
125
|
self.check_size(mat)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ok-script-0.0.87 → ok-script-0.0.88}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|