This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import glob | |
video_file_name = 'project.wmv' | |
path_to_images = 'path_2_video/*.bmp' | |
cmpt = 0 | |
for filename in glob.glob(path_to_images): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. | |
# Please read https://msg.pyyaml.org/load for full details. | |
import yaml | |
f = open(filaname_path, 'r') | |
yaml.load(f, Loader=yaml.FullLoader) | |
f.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You could use numpy directly, instead of cv_bridge | |
import numpy as np | |
im = np.frombuffer(image_data.data, dtype=np.uint8).reshape(image_data.height, image_data.width, -1) | |
pi | |
# Another solution // Still not yet tested | |
# Beautiful solution is to use ros_numpy (https://github.com/eric-wieser/ros_numpy). | |
# It is similar to the function of cv_bridge, but without the dependency on cv2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!bash | |
# install docker | |
# Step 1 — Installing Docker | |
# First, update your existing list of packages: | |
sudo apt update | |
# Next, install a few prerequisite packages which let apt use packages over HTTPS: | |
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# REMOVE the containers no longer running | |
docker rm $(docker ps -a -q) | |
# REMOVE the images without any attached container to them | |
docker rmi $(docker images -q -f dangling=true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this at the end of your entrypoint file | |
# to keep the container running and not exit directly | |
set -x | |
while $1 | |
do | |
echo "Press [CTRL+C] to stop.." | |
sleep 5 | |
echo "My second and third argument is $2 & $3" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reset last git commit | |
git reset --soft HEAD~1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tensorflow | |
from tensorflow.python.client import device_lib | |
devices_tf = device_lib.list_local_devices() | |
devices_tf = print(devices) | |
# pytorch | |
import torch | |
devices_torch = torch.cuda.get_device_name() | |
print(devices_torch) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a new container from the TensorFlow image | |
""" | |
$ docker run -it --rm tensorflow/tensorflow:latest-gpu-py3 | |
""" | |
You should be logged-in in the new container. You can explore it using ls, cd, etc… | |
You can exit using | |
$ exit. | |
Create a directory to exchange files between your machine and the container: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO Add the code below to your barshrc file | |
# Git branch in prompt. | |
force_color_prompt=yes | |
color_prompt=yes | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' |