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
def get_batch(self,bs=5): | |
bsize = bs if self.Q.qsize() > bs else self.Q.qsize() | |
if self.more() or not self.stopped: | |
frames = [] | |
for i in range(bsize): | |
frames.append(self.Q.get()) | |
return frames | |
return None |
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
#!/bin/bash | |
HOST='<IP ADDRESS>' | |
USER='<USER>' | |
PASS='<PASSWORD>' | |
TARGETFOLDER='/media/external/record' | |
SOURCEFOLDER='/tmp/sd/record' | |
lftp -f " | |
set ftp:passive-mode on | |
set ftp:ssl-allow yes |
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 tensorflow as tf | |
from tensorflow.python.compiler.tensorrt import trt_convert as trt | |
BATCH_SIZE = 2 | |
#GRAPH_PATH = '/home/gaiar/developer/megadetector/megadetector_v3_optimized.pb' | |
input_saved_model_dir = "/home/gaiar/developer/megadetector/megadetector/exported_model/saved_model" | |
output_saved_model_dir = "/home/gaiar/developer/megadetector/model_optimization/trt" | |
converter = trt.TrtGraphConverter( | |
input_saved_model_dir=input_saved_model_dir, |
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 the necessary packages | |
from threading import Thread | |
import sys | |
import cv2 | |
import time | |
from queue import Queue | |
class FileVideoStream: | |
def __init__(self, path, transform=None, resize=None, queue_size=128): |
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
# Playing video from file | |
cap = cv2.VideoCapture('rackoon.mp4') | |
# Default resolutions of the frame are obtained.The default resolutions are system dependent. | |
# We convert the resolutions from float to integer. | |
frame_width = int(cap.get(3)) | |
frame_height = int(cap.get(4)) | |
# Define the codec and create VideoWriter object.The output is stored in 'output.avi' file. | |
out = cv2.VideoWriter(FILE_OUTPUT, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'), |
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
#!/usr/bin/env bash | |
wget https://github.com/Archiconda/build-tools/releases/download/0.2.2/Archiconda3-0.2.2-Linux-aarch64.sh | |
chmod +x Archiconda3-0.2.2-Linux-aarch64.sh | |
./Archiconda3-0.2.2-Linux-aarch64.sh |
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
Epoch 1/10 | |
185/185 [==============================] - 266s 1s/step - loss: 0.2160 - acc: 0.9130 - val_loss: 0.7465 - val_acc: 0.6078 | |
Epoch 00001: val_loss improved from inf to 0.74645, saving model to models/bird-vs-not-bird-weights-01.h5 | |
Epoch 2/10 | |
185/185 [==============================] - 258s 1s/step - loss: 0.1484 - acc: 0.9437 - val_loss: 0.6983 - val_acc: 0.6101 | |
Epoch 00002: val_loss improved from 0.74645 to 0.69832, saving model to models/bird-vs-not-bird-weights-02.h5 | |
Epoch 3/10 | |
185/185 [==============================] - 258s 1s/step - loss: 0.1262 - acc: 0.9530 - val_loss: 0.6837 - val_acc: 0.6073 |
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
#Based on helper function from https://github.com/daanraman | |
import os | |
import shutil | |
import numpy as np | |
#Make sure all folders are present before running the script | |
ALL_DATA_HOME_DIR = "data" | |
DATA_TRAIN_DIR = "dataset/train" | |
DATA_TEST_DIR = "dataset/valid" |
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
#!/usr/bin/env python | |
#Based on https://stackoverflow.com/questions/748675/finding-duplicate-files-and-removing-them | |
import sys | |
import os | |
import hashlib | |
import logging | |
logging.basicConfig( | |
filename='duplicates.log', |
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 glob | |
import os | |
import shutil | |
import filetype | |
import logging | |
logging.basicConfig( | |
filename='renaming.log', | |
level=logging.DEBUG, | |
format='%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s', |
NewerOlder