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
!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
# 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
# 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
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
# import necessary packages | |
from numpy import expand_dims | |
from keras.models import load_model | |
from keras.preprocessing.image import load_img | |
from keras.preprocessing.image import img_to_array | |
import time | |
import pdb | |
# load and prepare an image | |
def load_image_pixels(filename, shape): |
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 argparse | |
import cv2 | |
import numpy as np | |
parser = argparse.ArgumentParser(add_help=False) | |
parser.add_argument("--image", default='samples/image.jpg', help="image for prediction") | |
parser.add_argument("--config", default='cfg/yolov3.cfg', help="YOLO config path") | |
parser.add_argument("--weights", default='yolov3.weights', help="YOLO weights path") | |
parser.add_argument("--names", default='data/coco.names', help="class names path") |
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
# Docker-CE on Ubuntu can be installed using Docker's official convenience script: | |
curl https://get.docker.com | sh \ | |
&& sudo systemctl --now enable docker | |
# Setting up NVIDIA Container Toolkit | |
# Setup the stable repository and the GPG key: | |
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list |
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
#!/bin/bash | |
# Installation instructions from https://docs.docker.com/engine/install/ubuntu/ | |
# Update the apt package index and install packages to allow apt to use a repository over HTTPS: | |
sudo apt update | |
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
# Add Docker’s official GPG key | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
# Use the following command to set up the stable repository | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
# INSTALL DOCKER ENGINE |
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
# initial code from https://github.com/ros-perception/vision_opencv/blob/noetic/cv_bridge/python/cv_bridge/core.py | |
import cv2 | |
import numpy as np | |
import sensor_msgs | |
def cv2_to_imgmsg(cvim, encoding="passthrough", header=None): | |
if not isinstance(cvim, (np.ndarray, np.generic)): | |
raise TypeError('Your input type is not a numpy array') | |
# prepare msg | |
img_msg = sensor_msgs.msg.Image() |