This file contains 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 numpy as np # numpy - manipulate the packet data returned by depthai | |
import cv2 # opencv - display the video stream | |
import depthai # access the camera and its data packets | |
import consts.resource_paths # load paths to depthai resources | |
import os | |
device = depthai.Device("", False) | |
# Create the pipeline using the 'depth_sipp' stream, establishing the first connection to the device. | |
pipeline = device.create_pipeline(config={ |
This file contains 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
Repository | Author | Dataset | Model | Input shape | Platform | URL | |
---|---|---|---|---|---|---|---|
FaceMaskDetection | AIZOOTech | AIZOOTech (7959 images) | Small CNN (SSD) | 260 x 260 | Multiple | https://github.com/AIZOOTech/FaceMaskDetection | |
Face-Mask-Detection | chandrikadeb7 | Custom (3835 images) | ResNet (SSD) (face detection) + MovileNetV2 (mask classification) | 300 x 300 (face detection) + 224 x 224 (mask classification) | Tensorflow + OpenCV | https://github.com/chandrikadeb7/Face-Mask-Detection | |
face-mask-detection-tf2 | PureHing | Modified AIZOOTech (7959 images) | Mobilenet + RFB (SSD) | 240 x 240 | Tensorflow 2.1 | https://github.com/PureHing/face-mask-detection-tf2 | |
Face-Mask-Detection | mk-gurucharan | Prajna Bhandary’s dataset (1376 images) | Cascade Classifier for face detection + very small CNN for face mask classification | 150 x 150 | Tensorflow + OpenCV | https://github.com/mk-gurucharan/Face-Mask-Detection | |
face_mask_detection | Spidy20 | Custom (using webcam) | faster_rcnn_inception_v2 | 312 x 224 | Tensorflow | https://github.com/Spidy20/face_mask_de |
This file contains 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 numpy as np | |
import cv2 | |
from demo_helpers import config, capture_image, get_detection, calculate_frame_speed, decode_mobilenet_ssd, show_mobilenet_ssd | |
from time import time, sleep, monotonic | |
import os | |
import depthai | |
print('Using depthai module from: ', depthai.__file__) | |
# Create a list of enabled streams () | |
stream_names = ['metaout', 'previewout'] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
# Referenes: | |
# - Resize and pad: https://stackoverflow.com/questions/44720580/resize-image-canvas-to-maintain-square-aspect-ratio-in-python-opencv | |
# - Mediapipe image scale and offset: https://github.com/google/mediapipe/blob/ecb5b5f44ab23ea620ef97a479407c699e424aa7/mediapipe/calculators/tensor/image_to_tensor_utils.cc#L79 | |
# - Mediapipe OpenCV image resize: https://github.com/google/mediapipe/blob/ecb5b5f44ab23ea620ef97a479407c699e424aa7/mediapipe/framework/deps/image_resizer.h#L27 | |
import mediapipe as mp | |
from mediapipe.python import solution_base | |
import cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt |
This file contains 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
# Referenes: | |
# - Mediapipe face detection models: https://github.com/google/mediapipe/tree/master/mediapipe/modules/face_detection | |
import os | |
import urllib | |
import mediapipe as mp | |
from mediapipe.python import solution_base | |
import cv2 | |
import numpy as np |
This file contains 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
images = np.zeros((1, 3, 360, 640), dtype=np.float32) | |
masks = np.ones((1, 1, 360, 640), dtype=np.float32) | |
torch.onnx.export(nnet.model, | |
(images, masks), | |
"model_float32.onnx", | |
export_params=True, | |
opset_version=11, | |
do_constant_folding=True, | |
input_names = ['input_rgb','input_mask'], |
This file contains 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
from tempfile import mkstemp | |
from shutil import move, copymode | |
from os import fdopen, remove | |
import os | |
# Ref: https://github.com/luxonis/depthai-python/blob/main/src/pipeline/PipelineBindings.cpp | |
pattern_replacement = { "create(dai.node.XLinkIn)" : "createXLinkIn()", | |
"create(dai.node.XLinkOut)" : "createXLinkOut()", | |
"create(dai.node.NeuralNetwork)" : "createNeuralNetwork()", | |
"create(dai.node.ColorCamera)" : "createColorCamera()", |
This file contains 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
from tempfile import mkstemp | |
from shutil import move, copymode | |
from os import fdopen, remove | |
import os | |
# Ref: https://github.com/luxonis/depthai-python/blob/main/src/pipeline/PipelineBindings.cpp | |
pattern_replacement = { "createXLinkIn()" : "create(dai.node.XLinkIn)", | |
"createXLinkOut()" : "create(dai.node.XLinkOut)", | |
"createNeuralNetwork()" : "create(dai.node.NeuralNetwork)", | |
"createColorCamera()" : "create(dai.node.ColorCamera)", |
This file contains 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
from tempfile import mkstemp | |
from shutil import move, copymode | |
from os import fdopen, remove | |
import os | |
import re | |
def has_old_style(file_path): | |
pattern = "CODE=" |
OlderNewer