Skip to content

Commit 8b96b7a

Browse files
authored
Fix augmentations and matplotlib (#1179)
* * skip augmentations when list is empty * replacye spurios __file__ in load_config with os.getcwd() * pin matplotlib versions to 3.8.* * fix log statement in training * * fix layout height for ui widgets in macos (i.e. platform darwin) * * pin pytest to 8.1 for non-backwards compatible change * Fix test selection to correctly identify RPi hardware as 'aarch64' and not 'arm64' which is what Apple Silicon is now reporting.
1 parent 45dc516 commit 8b96b7a

File tree

9 files changed

+18
-16
lines changed

9 files changed

+18
-16
lines changed

donkeycar/config.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ def to_pyfile(self, path):
6666
def load_config(config_path=None, myconfig="myconfig.py"):
6767

6868
if config_path is None:
69-
import __main__ as main
70-
main_path = os.path.dirname(os.path.realpath(main.__file__))
69+
main_path = os.getcwd()
7170
config_path = os.path.join(main_path, 'config.py')
7271
if not os.path.exists(config_path):
7372
local_config = os.path.join(os.path.curdir, 'config.py')

donkeycar/management/ui/common.kv

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#:import platform sys.platform
22

3-
#:set common_height 30
3+
#:set reduced_height 40 if platform == 'darwin' else 20
4+
#:set common_height 60 if platform == 'darwin' else 30
45
#:set spacing 10
56
#:set layout_height common_height + spacing
67

@@ -226,7 +227,7 @@
226227
current_field: data_spinner.text
227228
BoxLayout:
228229
size_hint_y: None
229-
height: 20
230+
height: reduced_height
230231
spacing: 2
231232
MyLabel:
232233
id: label

donkeycar/management/ui/pilot_screen.kv

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
pilot_loader: pilot_loader
105105
DataPanel:
106106
size_hint_y: None
107-
height: 20 + (self.minimum_height - 20) * 15
107+
height: reduced_height + (self.minimum_height - reduced_height) * 15
108108
id: data_panel
109109
is_linked: True
110110
font_color: [0.2, 0.2, 1, 1]
@@ -126,7 +126,7 @@
126126
BackgroundBoxLayout:
127127
orientation: 'vertical'
128128
size_hint_y: None
129-
height: self.minimum_height +60
129+
height: self.minimum_height + 2 * common_height
130130
Header:
131131
title: 'Multi Pilot Loader'
132132
description:
@@ -217,7 +217,7 @@
217217
BackgroundBoxLayout:
218218
orientation: 'vertical'
219219
size_hint_y: None
220-
height: self.minimum_height + 90
220+
height: self.minimum_height + 3 * common_height
221221
Slider:
222222
size_hint_y: None
223223
height: common_height

donkeycar/management/ui/train_screen.kv

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
orientation: 'vertical'
124124
spacing: spacing
125125
size_hint_y: None
126-
height: self.minimum_height + 80
126+
height: self.minimum_height + 4 * reduced_height
127127
Header:
128128
size_hint_y: 1.5
129129
id: cfg_header

donkeycar/management/ui/ui.kv

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ BoxLayout:
1313
ActionView:
1414
id: av
1515
size_hint_y: None
16-
height: 20
16+
height: reduced_height
1717

1818
ActionPrevious:
1919
with_previous: False

donkeycar/pipeline/augmentations.py

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def create(cls, aug_type: str, config: Config, prob, always) -> \
4040

4141
# Parts interface
4242
def run(self, img_arr):
43+
if len(self.augmentations) == 0:
44+
return img_arr
4345
aug_img_arr = self.augmentations(image=img_arr)["image"]
4446
return aug_img_arr
4547

donkeycar/pipeline/training.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def train(cfg: Config, tub_paths: str, model: str = None,
153153
assert val_size > 0, "Not enough validation data, decrease the batch " \
154154
"size or add more data."
155155
logger.info(f'Train with image caching: '
156-
f'{getattr(cfg, "CACHE_IMAGES", True)}')
156+
f'{getattr(cfg, "CACHE_IMAGES", "ARRAY")}')
157157
history = kl.train(model_path=model_path,
158158
train_data=dataset_train,
159159
train_steps=train_size,

donkeycar/tests/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def on_pi():
10-
if 'arm' in platform.machine():
10+
if 'aarch64' in platform.machine():
1111
return True
1212
return False
1313

setup.cfg

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pi =
5252
flatbuffers==24.3.*
5353
tensorflow-aarch64==2.15.*
5454
opencv-contrib-python
55-
matplotlib
55+
matplotlib==3.8.*
5656
kivy
5757
kivy-garden.matplotlib
5858
pandas
@@ -73,24 +73,24 @@ nano =
7373

7474
pc =
7575
tensorflow==2.15.*
76-
matplotlib
76+
matplotlib==3.8.*
7777
kivy
7878
kivy-garden.matplotlib
7979
pandas
8080
plotly
8181
albumentations
8282

8383
macos =
84-
tensorflow-macos==2.15.*
85-
matplotlib
84+
tensorflow==2.15.*
85+
matplotlib==3.8.*
8686
kivy
8787
kivy-garden.matplotlib
8888
pandas
8989
plotly
9090
albumentations
9191

9292
dev =
93-
pytest
93+
pytest==8.1.*
9494
pytest-cov
9595
responses
9696
mypy

0 commit comments

Comments
 (0)