learning-loop-node 0.13.2__py3-none-any.whl → 0.13.4__py3-none-any.whl

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.

Potentially problematic release.


This version of learning-loop-node might be problematic. Click here for more details.

@@ -200,8 +200,11 @@ class DetectorNode(Node):
200
200
  """The DetectorNode acts as a SocketIO server. This method sets up the server and defines the event handlers."""
201
201
  # pylint: disable=unused-argument
202
202
 
203
- # Initialize the Socket.IO server
204
- self.sio = socketio.AsyncServer(async_mode='asgi')
203
+ # Initialize the Socket.IO server with 20MB buffer size
204
+ self.sio = socketio.AsyncServer(
205
+ async_mode='asgi',
206
+ max_http_buffer_size=2e7, # 20MB
207
+ )
205
208
  # Initialize and mount the ASGI app
206
209
  self.sio_app = socketio.ASGIApp(self.sio, socketio_path='/socket.io')
207
210
  self.mount('/ws', self.sio_app)
@@ -401,6 +404,7 @@ class DetectorNode(Node):
401
404
 
402
405
  self.log_status_on_change(status.state or 'None', status)
403
406
 
407
+ # NOTE: sending organization and project is no longer required!
404
408
  response = await self.sio_client.call('update_detector', (self.organization, self.project, jsonable_encoder(asdict(status))))
405
409
  if not response:
406
410
  self.socket_connection_broken = True
@@ -1,8 +1,8 @@
1
1
  import os
2
2
  from typing import List, Union
3
3
 
4
- from learning_loop_node.data_classes import (BoxDetection, ClassificationDetection, ImageMetadata, Observation,
5
- PointDetection, SegmentationDetection)
4
+ from ...data_classes import (BoxDetection, ClassificationDetection, ImageMetadata, Observation, PointDetection,
5
+ SegmentationDetection)
6
6
 
7
7
 
8
8
  class CamObservationHistory:
@@ -79,10 +79,10 @@ class Outbox():
79
79
  image_metadata.source = source or 'unknown'
80
80
  os.makedirs(tmp, exist_ok=True)
81
81
 
82
- with open(tmp + '/image.json', 'w') as f:
82
+ with open(tmp + f'/image_{identifier}.json', 'w') as f:
83
83
  json.dump(jsonable_encoder(asdict(image_metadata)), f)
84
84
 
85
- with open(tmp + '/image.jpg', 'wb') as f:
85
+ with open(tmp + f'/image_{identifier}.jpg', 'wb') as f:
86
86
  f.write(image)
87
87
 
88
88
  if os.path.exists(tmp):
@@ -141,8 +141,10 @@ class Outbox():
141
141
  # results in a post failure on the first run of the test in a docker environment (WTF)
142
142
 
143
143
  data: List[Tuple[str, Union[TextIOWrapper, BufferedReader]]] = []
144
- data = [('files', open(f'{item}/image.json', 'r')) for item in items]
145
- data += [('files', open(f'{item}/image.jpg', 'rb')) for item in items]
144
+ for item in items:
145
+ identifier = os.path.basename(item)
146
+ data.append(('files', open(f'{item}/image_{identifier}.json', 'r')))
147
+ data.append(('files', open(f'{item}/image_{identifier}.jpg', 'rb')))
146
148
 
147
149
  try:
148
150
  async with aiohttp.ClientSession() as session:
@@ -158,7 +160,11 @@ class Outbox():
158
160
  if response.status == 200:
159
161
  self.upload_counter += len(items)
160
162
  for item in items:
161
- shutil.rmtree(item, ignore_errors=True)
163
+ try:
164
+ shutil.rmtree(item)
165
+ self.log.debug('Deleted %s', item)
166
+ except Exception:
167
+ self.log.exception('Failed to delete %s', item)
162
168
  self.log.info('Uploaded %s images successfully', len(items))
163
169
 
164
170
  elif response.status == 422:
@@ -36,8 +36,8 @@ async def test_initialized_trainer_node():
36
36
  'model_variant': '',
37
37
  'hyperparameters': {
38
38
  'resolution': 800,
39
- 'flip_rl': False,
40
- 'flip_ud': False}
39
+ 'fliplr': 0.5,
40
+ 'flipud': 0.5}
41
41
  })
42
42
  await node._on_startup()
43
43
  yield node
@@ -59,8 +59,8 @@ async def test_initialized_trainer():
59
59
  'model_variant': '',
60
60
  'hyperparameters': {
61
61
  'resolution': 800,
62
- 'flip_rl': False,
63
- 'flip_ud': False}
62
+ 'fliplr': 0.5,
63
+ 'flipud': 0.5}
64
64
  })
65
65
  yield trainer
66
66
  try:
@@ -402,7 +402,7 @@ class TrainerLogicGeneric(ABC):
402
402
  """
403
403
 
404
404
  files = await self._get_latest_model_files()
405
- if files is None:
405
+ if files is None or len(files) == 0:
406
406
  raise CriticalError('Could not get latest model files. Training might have failed.')
407
407
 
408
408
  if isinstance(files, List):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: learning-loop-node
3
- Version: 0.13.2
3
+ Version: 0.13.4
4
4
  Summary: Python Library for Nodes which connect to the Zauberzeug Learning Loop
5
5
  Home-page: https://github.com/zauberzeug/learning_loop_node
6
6
  License: MIT
@@ -12,11 +12,11 @@ learning_loop_node/data_classes/training.py,sha256=FFPsr2AA7ynYz39MLZaFJ0sF_9Axl
12
12
  learning_loop_node/data_exchanger.py,sha256=IG5ki3f3IsVuXbyw6q_gUIakgv-GMT6e9nhOhzjKgW4,9055
13
13
  learning_loop_node/detector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  learning_loop_node/detector/detector_logic.py,sha256=FhGbu0mdF0tW0Gg8cr8xM6ZmZzEigGf0IcAWBjoxFrs,2191
15
- learning_loop_node/detector/detector_node.py,sha256=KOvciUk47sk4O0ZZqilVVdtO3FS7t9usilsW4DFWRRM,24988
15
+ learning_loop_node/detector/detector_node.py,sha256=2DpolliA36HIOvFqNeZaBOX2vwKL58i1rEJidPcFymM,25151
16
16
  learning_loop_node/detector/inbox_filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- learning_loop_node/detector/inbox_filter/cam_observation_history.py,sha256=8gzxYPD3t1OS9wBHXfIvNV2xTTMo0B70O1b50iaH2D8,3344
17
+ learning_loop_node/detector/inbox_filter/cam_observation_history.py,sha256=1PHgXRrhSQ34HSFw7mdX8ndRxHf_i1aP5nXXnrZxhAY,3312
18
18
  learning_loop_node/detector/inbox_filter/relevance_filter.py,sha256=NPEmrAtuGjIWCtHS0B3zDmnYWkhVFCLbd_7RUp08_AM,1372
19
- learning_loop_node/detector/outbox.py,sha256=CYuXI6uXQ_mrVPZ0qvNgdSZH1nLarcs7Fj_7Mb3k7MA,8558
19
+ learning_loop_node/detector/outbox.py,sha256=i12X28FJka8HMm4iqE7SCODT1uCEtM53tIBul3uxKFw,8828
20
20
  learning_loop_node/detector/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  learning_loop_node/detector/rest/about.py,sha256=evHJ2svUZY_DFz0FSef5u9c5KW4Uc3GL7EbPinG9-dg,583
22
22
  learning_loop_node/detector/rest/backdoor_controls.py,sha256=ZNaFOvC0OLWNtcLiG-NIqS_y1kkLP4csgk3CHhp8Gis,885
@@ -70,7 +70,7 @@ learning_loop_node/tests/general/test_downloader.py,sha256=y4GcUyR0OAfrwltd6eyQg
70
70
  learning_loop_node/tests/general/test_learning_loop_node.py,sha256=SZd-VChpWnnsPN46pr4E_LL3ZevYx6psU-AWdVeOFpQ,770
71
71
  learning_loop_node/tests/test_helper.py,sha256=Xajn6BWJqeD36YAETwdcJd6awY2NPmaOis3gWgFc97k,2909
72
72
  learning_loop_node/tests/trainer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- learning_loop_node/tests/trainer/conftest.py,sha256=X-Ib-ju-emKomgaPjddwAgMp0zt2Slu59Y3cPfmTipI,3672
73
+ learning_loop_node/tests/trainer/conftest.py,sha256=F8b8cVJeDRG08OufAE4TuG4Dm-ViSyK_PzM2DrHUzJQ,3660
74
74
  learning_loop_node/tests/trainer/pytest.ini,sha256=8QdjmawLy1zAzXrJ88or1kpFDhJw0W5UOnDfGGs_igU,262
75
75
  learning_loop_node/tests/trainer/state_helper.py,sha256=MDe9opeKruip74FoRFff8MSWGiQNFqDpPtIEIbgPnFc,919
76
76
  learning_loop_node/tests/trainer/states/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -94,8 +94,8 @@ learning_loop_node/trainer/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
94
94
  learning_loop_node/trainer/rest/backdoor_controls.py,sha256=ZnK8ypY5r_q0-YZbtaOxhQThzuZvMsQHM5gJGESd_dE,5131
95
95
  learning_loop_node/trainer/test_executor.py,sha256=6BVGDN_6f5GEMMEvDLSG1yzMybSvgXaP5uYpSfsVPP0,2224
96
96
  learning_loop_node/trainer/trainer_logic.py,sha256=eK-01qZzi10UjLMCQX8vy5eW2FoghPj3rzzDC-s3Si4,8792
97
- learning_loop_node/trainer/trainer_logic_generic.py,sha256=JGH2IClpte8WqO_Pmh7Epa-328Pyl5RYYZlWgOdygvs,26827
97
+ learning_loop_node/trainer/trainer_logic_generic.py,sha256=RQqon8JIVzxaNh0KdEe6tMxebsY0DgZllEohHR-AgqU,26846
98
98
  learning_loop_node/trainer/trainer_node.py,sha256=Dl4ZQAjjXQggibeBjvhXAoFClw1ZX2Kkt3v_fjrJnCI,4508
99
- learning_loop_node-0.13.2.dist-info/METADATA,sha256=UbvoOq2ILuCNphcOeajrlbOSNdAwtLvwEVcm4gSfmmI,12761
100
- learning_loop_node-0.13.2.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
101
- learning_loop_node-0.13.2.dist-info/RECORD,,
99
+ learning_loop_node-0.13.4.dist-info/METADATA,sha256=PCQ2UaAA26NGRvbsCnjf2uWla3Qf-WBjfCs1o5gsgJs,12761
100
+ learning_loop_node-0.13.4.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
101
+ learning_loop_node-0.13.4.dist-info/RECORD,,