ok-script 0.0.36__tar.gz → 0.0.37__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.36 → ok-script-0.0.37}/PKG-INFO +1 -1
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/adb/ADBCaptureMethod.py +14 -19
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/adb/DeviceManager.py +9 -3
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/interaction/ADBInteraction.py +1 -1
- {ok-script-0.0.36 → ok-script-0.0.37}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.36 → ok-script-0.0.37}/ok_script.egg-info/SOURCES.txt +0 -2
- {ok-script-0.0.36 → ok-script-0.0.37}/setup.py +1 -1
- ok-script-0.0.36/ok/predict/predict.py +0 -45
- ok-script-0.0.36/ok/util/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/README.md +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/OK.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/BaseCaptureMethod.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/HwndWindow.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/adb/targets.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/adb/vbox.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/color/Color.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/color/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/config/Config.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/config/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/feature/Box.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/App.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/MainWindow.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/resources.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/start/SelectHwndWindow.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/start/StartCard.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.36/ok/predict → ok-script-0.0.37/ok/rotypes/Windows/Media}/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.36/ok/rotypes/Windows/Media → ok-script-0.0.37/ok/rotypes/Windows/Security}/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.36/ok/rotypes/Windows/Security → ok-script-0.0.37/ok/rotypes/Windows/Storage}/__init__.py +0 -0
- {ok-script-0.0.36/ok/rotypes/Windows/Storage → ok-script-0.0.37/ok/rotypes/Windows}/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.36/ok/rotypes/Windows → ok-script-0.0.37/ok/save}/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.36/ok/save → ok-script-0.0.37/ok/scene}/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.36/ok/scene → ok-script-0.0.37/ok/stats}/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/task/BaseTask.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/task/ExecutorOperation.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/task/TaskExecutor.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.36/ok/stats → ok-script-0.0.37/ok/task}/__init__.py +0 -0
- {ok-script-0.0.36/ok/task → ok-script-0.0.37/ok/util}/__init__.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/util/json.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/util/list.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/util/path.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/util/thread.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok/util/yaml.py +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.36 → ok-script-0.0.37}/setup.cfg +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# original https://github.com/Toufool/AutoSplit/blob/master/src/capture_method/WindowsGraphicsCaptureMethod.py
|
|
2
2
|
import cv2
|
|
3
3
|
import numpy as np
|
|
4
|
-
from adbutils import AdbError
|
|
5
4
|
from typing_extensions import override
|
|
6
5
|
|
|
7
6
|
from ok.capture.BaseCaptureMethod import BaseCaptureMethod
|
|
@@ -14,12 +13,12 @@ class ADBCaptureMethod(BaseCaptureMethod):
|
|
|
14
13
|
name = "ADB command line Capture"
|
|
15
14
|
description = "use the adb screencap command, slow but works when in background/minimized, takes 300ms per frame"
|
|
16
15
|
|
|
17
|
-
def __init__(self,
|
|
16
|
+
def __init__(self, device_manager, exit_event, width=0, height=0):
|
|
18
17
|
super().__init__()
|
|
19
18
|
self.exit_event = exit_event
|
|
20
19
|
self._size = (width, height)
|
|
21
20
|
self._connected = (width != 0 and height != 0)
|
|
22
|
-
self.
|
|
21
|
+
self.device_manager = device_manager
|
|
23
22
|
|
|
24
23
|
@property
|
|
25
24
|
def width(self):
|
|
@@ -40,7 +39,7 @@ class ADBCaptureMethod(BaseCaptureMethod):
|
|
|
40
39
|
def screencap(self):
|
|
41
40
|
if self.exit_event.is_set():
|
|
42
41
|
return None
|
|
43
|
-
frame = do_screencap(self.
|
|
42
|
+
frame = do_screencap(self.device_manager)
|
|
44
43
|
if frame is not None:
|
|
45
44
|
height, width, _ = frame.shape
|
|
46
45
|
self._connected = True
|
|
@@ -50,21 +49,17 @@ class ADBCaptureMethod(BaseCaptureMethod):
|
|
|
50
49
|
return frame
|
|
51
50
|
|
|
52
51
|
def connected(self):
|
|
53
|
-
if not self._connected and self.device is not None:
|
|
52
|
+
if not self._connected and self.device_manager.device is not None:
|
|
54
53
|
self.screencap()
|
|
55
|
-
return self._connected and self.device is not None
|
|
54
|
+
return self._connected and self.device_manager.device is not None
|
|
56
55
|
|
|
57
56
|
|
|
58
|
-
def do_screencap(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
else:
|
|
68
|
-
logger.error(f"Screencap image decode error, probably disconnected")
|
|
69
|
-
except AdbError as e:
|
|
70
|
-
logger.error(f"Device {device} error", e)
|
|
57
|
+
def do_screencap(device_manager) -> np.ndarray | None:
|
|
58
|
+
png_bytes = device_manager.shell("screencap -p", encoding=None)
|
|
59
|
+
if png_bytes is not None and len(png_bytes) > 0:
|
|
60
|
+
image_data = np.frombuffer(png_bytes, dtype=np.uint8)
|
|
61
|
+
image = cv2.imdecode(image_data, cv2.IMREAD_COLOR)
|
|
62
|
+
if image is not None:
|
|
63
|
+
return image
|
|
64
|
+
else:
|
|
65
|
+
logger.error(f"Screencap image decode error, probably disconnected")
|
|
@@ -2,6 +2,7 @@ import threading
|
|
|
2
2
|
|
|
3
3
|
import adbutils
|
|
4
4
|
import win32gui
|
|
5
|
+
from adbutils import AdbError
|
|
5
6
|
|
|
6
7
|
from ok.capture.HwndWindow import HwndWindow, find_hwnd_by_title_and_exe
|
|
7
8
|
from ok.capture.adb.ADBCaptureMethod import ADBCaptureMethod, do_screencap
|
|
@@ -217,7 +218,7 @@ class DeviceManager:
|
|
|
217
218
|
elif not isinstance(self.capture_method, ADBCaptureMethod):
|
|
218
219
|
if self.capture_method is not None:
|
|
219
220
|
self.capture_method.close()
|
|
220
|
-
self.capture_method = ADBCaptureMethod(self
|
|
221
|
+
self.capture_method = ADBCaptureMethod(self, self.exit_event, width=width,
|
|
221
222
|
height=height)
|
|
222
223
|
self.interaction = ADBBaseInteraction(self, self.capture_method, width, height)
|
|
223
224
|
if self.debug and hwnd_name:
|
|
@@ -255,5 +256,10 @@ class DeviceManager:
|
|
|
255
256
|
if device is not None:
|
|
256
257
|
try:
|
|
257
258
|
return device.shell(*args, **kwargs)
|
|
258
|
-
except
|
|
259
|
-
|
|
259
|
+
except AdbError as e:
|
|
260
|
+
addr = self.get_preferred_device()['address']
|
|
261
|
+
self.adb.connect(addr)
|
|
262
|
+
logger.error(f"shell_wrapper error occurred: {e} ,try reconnect {addr}")
|
|
263
|
+
return device.shell(*args, **kwargs)
|
|
264
|
+
else:
|
|
265
|
+
raise Exception('Device is none')
|
|
@@ -27,4 +27,4 @@ class ADBBaseInteraction(BaseInteraction):
|
|
|
27
27
|
super().click(x, y)
|
|
28
28
|
x = int(x * self.width / self.capture.width)
|
|
29
29
|
y = int(y * self.height / self.capture.height)
|
|
30
|
-
self.device_manager.
|
|
30
|
+
self.device_manager.shell(f"input tap {x} {y}")
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import torch
|
|
2
|
-
from PIL import Image, ImageDraw
|
|
3
|
-
import numpy as np
|
|
4
|
-
from ultralytics import YOLO
|
|
5
|
-
|
|
6
|
-
# Load the model
|
|
7
|
-
# model = torch.hub.load('ultralytics/yolov8', 'custom', path='models/best.pt')
|
|
8
|
-
model = YOLO('models/best.pt') # pretrained YOLOv8n model
|
|
9
|
-
|
|
10
|
-
# Run batched inference on a list of images
|
|
11
|
-
# results = model(['im1.jpg', 'im2.jpg']) # return a list of Results objects
|
|
12
|
-
|
|
13
|
-
# Load an image
|
|
14
|
-
image_path = 'images/3.jpg'
|
|
15
|
-
image = Image.open(image_path)
|
|
16
|
-
|
|
17
|
-
# Perform inference
|
|
18
|
-
results = model(image)
|
|
19
|
-
|
|
20
|
-
# Extract data
|
|
21
|
-
for result in results:
|
|
22
|
-
boxes = result.boxes # Boxes object for bbox outputs
|
|
23
|
-
print(boxes)
|
|
24
|
-
masks = result.masks # Masks object for segmentation masks outputs
|
|
25
|
-
keypoints = result.keypoints # Keypoints object for pose outputs
|
|
26
|
-
probs = result.probs # Probs object for classification outputs
|
|
27
|
-
|
|
28
|
-
for r in results:
|
|
29
|
-
im_array = r.plot() # plot a BGR numpy array of predictions
|
|
30
|
-
im = Image.fromarray(im_array[..., ::-1]) # RGB PIL image
|
|
31
|
-
im.show() # show image
|
|
32
|
-
im.save('results.jpg') # save image
|
|
33
|
-
# labels, cord = results.xyxyn[0][:, -1], results.xyxyn[0][:, :-1]
|
|
34
|
-
|
|
35
|
-
# # Draw bounding boxes and labels
|
|
36
|
-
# draw = ImageDraw.Draw(image)
|
|
37
|
-
# for label, (*xyxy,) in zip(labels, cord):
|
|
38
|
-
# label = model.module.names[int(label)] # Get label name
|
|
39
|
-
# xyxy = (xyxy * np.array([image.width, image.height, image.width, image.height])).tolist() # Scale coords
|
|
40
|
-
# draw.rectangle(xyxy, outline='red', width=3)
|
|
41
|
-
# draw.text(xyxy[:2], label, fill='red')
|
|
42
|
-
|
|
43
|
-
# Save or display image
|
|
44
|
-
# image.save('output/1.jpg')
|
|
45
|
-
# image.show()
|
|
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.36 → ok-script-0.0.37}/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
|
{ok-script-0.0.36/ok/rotypes/Windows/Storage → ok-script-0.0.37/ok/rotypes/Windows}/__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
|