Skip to content

Commit

Permalink
tweaks and more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
BogGyver committed Apr 9, 2020
1 parent 8ec2213 commit 3cadbda
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if arch == "aarch64":
if is_tbp:
webcam=True
lenv = {
"LD_LIBRARY_PATH": '/usr/lib',
"LD_LIBRARY_PATH": '/usr/lib:/usr/local/lib/:/usr/lib/aarch64-linux-gnu',
"PATH": os.environ['PATH'],
"ANDROID_DATA": "/data",
"ANDROID_ROOT": "/",
Expand Down
4 changes: 4 additions & 0 deletions common/basedir.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))

from common.android import ANDROID
WEBCAM = os.getenv("WEBCAM") is not None
if ANDROID:
PERSIST = "/persist"
PARAMS = "/data/params"
elif WEBCAM:
PERSIST = "/data/params/persist"
PARAMS = "/data/params"
else:
PERSIST = os.path.join(BASEDIR, "persist")
PARAMS = os.path.join(BASEDIR, "persist", "params")
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions selfdrive/camerad/cameras/camera_webcam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ void camera_release_buffer(void *cookie, int buf_idx) {
void open_gl_stream_def(CameraState * s, int video_id, int width, int height, char ** strm_def) {
printf("OPENGLSTREAM");
std::string strm_template="v4l2src device=/dev/video%d ! video/x-raw,width=%d,height=%d,framerate=%d/1,format=YUY2 !"
"nvvidconv ! video/x-raw(memory:NVMM),format=I420 !"
"nvvidconv ! video/x-raw,format=BGRx !"
"videoconvert ! video/x-raw,format=BGR !"
"videoscale ! video/x-raw,width=%d,height=%d !"
" nvvidconv ! video/x-raw(memory:NVMM),format=I420 !"
" nvvidconv ! video/x-raw,format=BGRx !"
" videoconvert ! video/x-raw,format=BGR !"
" videoscale ! video/x-raw,width=%d,height=%d !"
" appsink ";
* strm_def = (char*)calloc(300,1);
sprintf(*strm_def,strm_template.c_str(),video_id, width, height, s->fps, s->ci.frame_width, s->ci.frame_height);
Expand Down
3 changes: 2 additions & 1 deletion selfdrive/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ def main():
os.environ['PARAMS_PATH'] = PARAMS

# the flippening!
os.system('LD_LIBRARY_PATH="" content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1')
if not WEBCAM:
os.system('LD_LIBRARY_PATH="" content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1')

# disable bluetooth
os.system('service call bluetooth_manager 8')
Expand Down
8 changes: 6 additions & 2 deletions selfdrive/modeld/runners/keras_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ def run_loop(m):
print(tf.__version__, file=sys.stderr)
# limit gram alloc
gpus = tf.config.experimental.list_physical_devices('GPU')
if len(gpus) > 0:
tf.config.experimental.set_virtual_device_configuration(gpus[0], [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=2048)])
name = sys.argv[1].split('.keras')[0]
if name == "supercombo":
if len(gpus) > 0:
tf.config.experimental.set_virtual_device_configuration(gpus[0], [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=2048)])
else:
if len(gpus) > 0:
tf.config.experimental.set_virtual_device_configuration(gpus[0], [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=1024)])
with open(f"{name}.model.keras", "r") as json_file:
m = model_from_json(json_file.read())
m.load_weights(f"{name}.weights.keras")
Expand Down

0 comments on commit 3cadbda

Please sign in to comment.