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 'dart:io' as Io; | |
import 'package:image/image.dart'; | |
void main(){ | |
//Read an image from file | |
//You can also use other file format like jpeg, webp,TIFF, PSD, GIF | |
var imageFile = new Io.File('test.png').readAsBytesSync(); | |
//decodeImage will identify the format of the image and | |
// decode the image accordingly | |
Image image = decodeImage(imageFile); |
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 subprocess as sp | |
import time | |
while(True): | |
sp.call('ffmpeg -f v4l2 -framerate 25 -t 4 -video_size 640x480 -i /dev/video0 ./webcam_output.mp4 -y',shell=True) | |
print('Video Captured') | |
time.sleep(1) |
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 hikvisionapi import Client | |
import cv2 | |
import numpy as np | |
cam = Client('http://192.168.1.2','admin','admin123',timeout=1) | |
cap=cv2.VideoCapture('rtsp://admin:[email protected]:554/main/av_stream') | |
#response = cam.System.deviceInfo(method='get') | |
#print(response) | |
#motion_detection_info = cam.System.Video.inputs.channels[1].motionDetection(method='get') |
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 torch | |
from torch import nn | |
import torch.nn.functional as F | |
import abc | |
import pytorch_ssim | |
import torchvision.models as models | |
from torch.autograd import Variable | |
class AbstractAutoEncoder(nn.Module): |
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 | |
import numpy as np | |
import mrcnn.model as modellib # https://github.com/matterport/Mask_RCNN/ | |
from mrcnn.config import Config | |
import keras.backend as keras | |
PATH_TO_SAVE_FROZEN_PB ="./" | |
FROZEN_NAME ="saved_model.pb" | |
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
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
// var serviceAccount = require("/home/bmabir/dev/tran-dao-8e837f43806d.json"); | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault() | |
}); | |
const db = admin.firestore(); | |
// // Create and Deploy Your First Cloud Functions | |
// // https://firebase.google.com/docs/functions/write-firebase-functions | |
// |
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
MODEL_FILE = "frozen_inference_graph_257.pb" | |
# Load the TensorFlow model | |
converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph( | |
graph_def_file = MODEL_FILE, | |
input_arrays = ['sub_2'], # For the Xception model it needs to be `sub_7`, for MobileNet it would be `sub_2` | |
output_arrays = ['ResizeBilinear_2'], | |
input_shapes={'sub_2':[1,257,257,3]} | |
) |
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 os | |
import numpy as np | |
import tensorflow as tf | |
print(tf.__version__) |
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
# Default Optimization is choosen | |
converter.optimizations = [tf.lite.Optimize.DEFAULT] | |
# Convert to TFLite Model | |
tflite_model = converter.convert() | |
# Save Model as tflite format | |
tflite_path = "deeplabv3_mnv2_custom_257.tflite" | |
tflite_model_size = open(tflite_path, 'wb').write(tflite_model) |
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
git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
HOST='\[\033[02;36m\]\h'; HOST=' '$HOST | |
TIME='\[\033[01;31m\]\t \[\033[01;32m\]' | |
LOCATION=' \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).$' | |
BRANCH=' \[\033[00;33m\]$(git_branch)\[\033[00m\] ' | |
PS1=$TIME$BRANCH$USER$HOST$LOCATION |
OlderNewer