learning-loop-node 0.17.0__py3-none-any.whl → 0.17.2__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.

@@ -522,11 +522,14 @@ class DetectorNode(Node):
522
522
  It can be converted e.g. using cv2.imdecode(np.frombuffer(image, np.uint8), cv2.IMREAD_COLOR)"""
523
523
 
524
524
  await self.detection_lock.acquire()
525
- metadata = await run.io_bound(self.detector_logic.evaluate, raw_image)
525
+ try:
526
+ metadata = await run.io_bound(self.detector_logic.evaluate, raw_image)
527
+ finally:
528
+ self.detection_lock.release()
529
+
526
530
  metadata.tags.extend(tags)
527
531
  metadata.source = source
528
532
  metadata.created = creation_date
529
- self.detection_lock.release()
530
533
 
531
534
  fix_shape_detections(metadata)
532
535
  n_bo, n_cl = len(metadata.box_detections), len(metadata.classification_detections)
@@ -555,8 +558,15 @@ class DetectorNode(Node):
555
558
  This function infers the detections from all images, cares about uploading to the loop and returns the detections as a list of ImageMetadata."""
556
559
 
557
560
  await self.detection_lock.acquire()
558
- all_detections = await run.io_bound(self.detector_logic.batch_evaluate, raw_images)
559
- self.detection_lock.release()
561
+ try:
562
+ all_detections = await run.io_bound(self.detector_logic.batch_evaluate, raw_images)
563
+ finally:
564
+ self.detection_lock.release()
565
+
566
+ for metadata in all_detections.items:
567
+ metadata.tags.extend(tags)
568
+ metadata.source = source
569
+ metadata.created = creation_date
560
570
 
561
571
  for detections, raw_image in zip(all_detections.items, raw_images):
562
572
  fix_shape_detections(detections)
@@ -1,8 +1,14 @@
1
1
  import os
2
2
  from typing import List, Union
3
3
 
4
- from ...data_classes import (BoxDetection, ClassificationDetection, ImageMetadata, Observation, PointDetection,
5
- SegmentationDetection)
4
+ from ...data_classes import (
5
+ BoxDetection,
6
+ ClassificationDetection,
7
+ ImageMetadata,
8
+ Observation,
9
+ PointDetection,
10
+ SegmentationDetection,
11
+ )
6
12
 
7
13
 
8
14
  class CamObservationHistory:
@@ -10,6 +16,8 @@ class CamObservationHistory:
10
16
  self.reset_time = 3600
11
17
  self.recent_observations: List[Observation] = []
12
18
  self.iou_threshold = 0.5
19
+ self.min_uncertain_threshold = float(os.environ.get('MIN_UNCERTAIN_THRESHOLD', '0.3'))
20
+ self.max_uncertain_threshold = float(os.environ.get('MAX_UNCERTAIN_THRESHOLD', '0.6'))
13
21
 
14
22
  def forget_old_detections(self) -> None:
15
23
  self.recent_observations = [detection
@@ -25,7 +33,8 @@ class CamObservationHistory:
25
33
  continue
26
34
  if isinstance(detection, ClassificationDetection):
27
35
  # self.recent_observations.append(Observation(detection))
28
- causes.add('classification_detection')
36
+ if self.min_uncertain_threshold <= detection.confidence <= self.max_uncertain_threshold:
37
+ causes.add('uncertain')
29
38
  continue
30
39
 
31
40
  assert isinstance(detection, (BoxDetection, PointDetection)), f"Unknown detection type: {type(detection)}"
@@ -37,7 +46,7 @@ class CamObservationHistory:
37
46
  continue
38
47
 
39
48
  self.recent_observations.append(Observation(detection))
40
- if float(os.environ.get('MIN_UNCERTAIN_THRESHOLD', '0.3')) <= detection.confidence <= float(os.environ.get('MAX_UNCERTAIN_THRESHOLD', '0.6')):
49
+ if self.min_uncertain_threshold <= detection.confidence <= self.max_uncertain_threshold:
41
50
  causes.add('uncertain')
42
51
 
43
52
  return list(causes)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: learning-loop-node
3
- Version: 0.17.0
3
+ Version: 0.17.2
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
@@ -13,10 +13,10 @@ learning_loop_node/data_classes/training.py,sha256=TybwcCDf_NUaDUaOj30lPm-7Z3Qk9
13
13
  learning_loop_node/data_exchanger.py,sha256=nd9JNPLn9amIeTcSIyUPpbE97ORAcb5yNphvmpgWSUQ,9095
14
14
  learning_loop_node/detector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  learning_loop_node/detector/detector_logic.py,sha256=0RilHkb_IYFk-BXso1QJ8in01WodbN7XeAXsKzptovY,2470
16
- learning_loop_node/detector/detector_node.py,sha256=GosNSGsa0wA172xiYk94RT8mMicDI75J8xsZuidYNWg,29716
16
+ learning_loop_node/detector/detector_node.py,sha256=3xWI6kauXJx4WAe6iaRsdBxk-c0zAKEMusxTKQqOCyY,29961
17
17
  learning_loop_node/detector/exceptions.py,sha256=C6KbNPlSbtfgDrZx2Hbhm7Suk9jVoR3fMRCO0CkrMsQ,196
18
18
  learning_loop_node/detector/inbox_filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- learning_loop_node/detector/inbox_filter/cam_observation_history.py,sha256=1PHgXRrhSQ34HSFw7mdX8ndRxHf_i1aP5nXXnrZxhAY,3312
19
+ learning_loop_node/detector/inbox_filter/cam_observation_history.py,sha256=slPGm87TbBCfDUdpRTAM5yOz1An8Br5X_2HFJOGSrFg,3540
20
20
  learning_loop_node/detector/inbox_filter/relevance_filter.py,sha256=IpoJMBPAO5GSr2uGINNu5uFar_jxWQWbH0Lz6FQ3n1M,1501
21
21
  learning_loop_node/detector/outbox.py,sha256=HaNps_XEbvOZ-jlpZTCsk4Dbk5zq-vNYdKMBu001ckU,12132
22
22
  learning_loop_node/detector/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -100,6 +100,6 @@ learning_loop_node/trainer/test_executor.py,sha256=6BVGDN_6f5GEMMEvDLSG1yzMybSvg
100
100
  learning_loop_node/trainer/trainer_logic.py,sha256=eK-01qZzi10UjLMCQX8vy5eW2FoghPj3rzzDC-s3Si4,8792
101
101
  learning_loop_node/trainer/trainer_logic_generic.py,sha256=KcHmXr-Hp8_Wuejzj8odY6sRPqi6aw1SEXv3YlbjM98,27057
102
102
  learning_loop_node/trainer/trainer_node.py,sha256=tsAMzJewdS7Bi_1b9FwG0d2lGlv2lY37pgOLWr0bP_I,4582
103
- learning_loop_node-0.17.0.dist-info/METADATA,sha256=7obfPe_Nc6q2j40ns2teaGxoA1tpnmPFFd6XAIoeuvw,13979
104
- learning_loop_node-0.17.0.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
105
- learning_loop_node-0.17.0.dist-info/RECORD,,
103
+ learning_loop_node-0.17.2.dist-info/METADATA,sha256=iw2TwzqWwCht4SD4u9Z_Vqnt0n13ejGIlbti8-fMrKY,13979
104
+ learning_loop_node-0.17.2.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
105
+ learning_loop_node-0.17.2.dist-info/RECORD,,