Skip to content

Instantly share code, notes, and snippets.

Avatar

e96031413

View GitHub Profile
@e96031413
e96031413 / yolov3-tiny.cfg
Last active Oct 13, 2019
YOLOv3 Tiny的cfg檔案(針對單class)
View yolov3-tiny.cfg
[net]
# Testing
batch=16
subdivisions=16
# Training
# batch=64
# subdivisions=2
width=416
height=416
channels=3
@e96031413
e96031413 / yolov3.cfg
Created Oct 12, 2019
YOLOv3的cfg檔案(針對單class)
View yolov3.cfg
[net]
# Testing
# batch=1
# subdivisions=1
# Training
batch=16
subdivisions=16
width=288 # input image resolution in width
height=288 # input image resolution in height
channels=3 # color space of input image
@e96031413
e96031413 / opencv-image.py
Last active Oct 21, 2019
使用Python的OpenCV進行圖片人臉辨識
View opencv-image.py
import cv2
# 載入分類器
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
# 讀取圖片
img = cv2.imread('a.jpg')
# 轉成灰階圖片
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# 偵測臉部
faces = face_cascade.detectMultiScale(
gray,
@e96031413
e96031413 / opencv-video.py
Last active Oct 21, 2019
使用Python的OpenCV進行影片人臉辨識
View opencv-video.py
import cv2
# 載入分類器
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
# 從視訊鏡頭擷取影片.
#cap = cv2.VideoCapture(0)
# 使用現有影片
cap = cv2.VideoCapture('test.mp4')
@e96031413
e96031413 / LINE-Notify.py
Created Oct 20, 2019
使用LINE Notify TOKEN建立自己的Line BOT
View LINE-Notify.py
import requests
def lineNotifyMessage(token, msg):
headers = {
"Authorization": "Bearer " + token,
"Content-Type" : "application/x-www-form-urlencoded"
}
payload = {'message': msg}
r = requests.post("https://notify-api.line.me/api/notify", headers = headers, params = payload)
@e96031413
e96031413 / auto-predict.sh
Created Oct 25, 2019
將外網FTP所上傳的影片複製到darknet資料夾、針對影片進行辨識、將結果自動上傳到Youtube
View auto-predict.sh
cp /home/e96031413/PiToTX2/video/*.mp4 /home/e96031413/AlexeyAB/darknet/data/bird/video/
cp -a /home/e96031413/PiToTX2/image/. /home/e96031413/AlexeyAB/darknet/data/bird/image
#./darknet detector test cfg/voc.data cfg/yolov3.cfg yolov3_10000.weights data/bird/image/bird.jpg | tee predict_img_result.txt | sleep 1s ; kill $!
./darknet detector demo cfg/voc.data cfg/yolov3.cfg yolov3_10000.weights data/bird/video/test.mp4 -out_filename detect-result.avi | sleep 120s ; kill $!
youtube-upload --title="video from tx2" detect-result.avi
@e96031413
e96031413 / yolov2-tiny.cfg
Created Oct 26, 2019
YOLOv2 Tiny的cfg檔案(針對單class)
View yolov2-tiny.cfg
[net]
# Testing
batch=16
subdivisions=16
# Training
# batch=64
# subdivisions=2
width=416
height=416
channels=3
@e96031413
e96031413 / linebot_cwb.py
Created Dec 7, 2019
中央氣象局-行政區天氣概況LINE機器人
View linebot_cwb.py
import requests
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
#關閉瀏覽器跳出訊息
prefs = {
'profile.default_content_setting_values' :
{
'notifications' : 2
@e96031413
e96031413 / Upgrade_All_Packages_With_pip.py
Created Dec 24, 2019
Upgrade all of your python packages with pip at one time.
View Upgrade_All_Packages_With_pip.py
#only for pip >= 10.0.1
#for pip < 10.0.1, please upgrade your pip version with the following code
'''python -m pip install --user --upgrade pip'''
import pkg_resources
from subprocess import call
packages = [dist.project_name for dist in pkg_resources.working_set]
call("pip install --upgrade " + ' '.join(packages), shell=True)
@e96031413
e96031413 / text2speech.py
Created Dec 28, 2019
This script can help you ( Text to Speech )
View text2speech.py
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
while 1:
print('Enter the Word')
#可用中文、英文
s = input( )
speaker.Speak(s)