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
//STL CONTAINER Deque | |
#include <bits/stdc++.h> | |
#define p_d_i(d) for(deque<int>::iterator it= d.begin();it!=d.end();it++)cout<<*it<<" ";cout<<endl; | |
using namespace std; | |
int main() | |
{ | |
//same as vector | |
deque<int>d1; |
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 math | |
import cv2 | |
def rotate_image(image, angle): | |
image_center = tuple(np.array(image.shape[1::-1]) / 2) | |
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0) | |
result = cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR) | |
return result |
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
# filename: bibtex2item.py | |
# python bibtex2item.py | |
# keep the bibtex in refs.bib file | |
def convert(bibtex): | |
bibitem = '' | |
r = bibtex.split('\n') | |
i = 0 | |
while i < len(r): | |
line = r[i].strip() |
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 flask import Flask, request | |
from flask_restful import Resource, Api, reqparse | |
import json | |
import numpy as np | |
import base64 | |
# compression | |
import zlib |
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 base64 | |
import zlib | |
import requests | |
import time | |
t1 = time.time() | |
for _ in range(1000): | |
frame = np.random.randint(0,256, (416,416,3), dtype=np.uint8) # dummy rgb image |
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
syntax = "proto3"; | |
// input image, width, height | |
message B64Image { | |
string b64image = 1; | |
int32 width = 2; | |
int32 height = 3; | |
} | |
// output prediction |
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 grpc | |
from concurrent import futures | |
import time | |
import image_procedure | |
# import the generated classes | |
import image_procedure_pb2 | |
import image_procedure_pb2_grpc |
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 grpc | |
# import the generated classes | |
import image_procedure_pb2 | |
import image_procedure_pb2_grpc | |
# data encoding | |
import numpy as np | |
import base64 |
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
# A procedure which decodes base64 image, runs some machine learning model/ operation(s) (in our case we'll just return the mean of the pixel value) | |
import numpy as np | |
import base64 | |
import zlib | |
def predict(b64img_compressed, w, h): | |
b64decoded = base64.b64decode(b64img_compressed) | |
decompressed = b64decoded #zlib.decompress(b64decoded) |
OlderNewer