This file contains hidden or 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 | |
from tensorflow.python.profiler import profiler_client | |
tpu_profile_service_address = os.environ['COLAB_TPU_ADDR'].replace('8470', '8466') | |
print(profiler_client.monitor(tpu_profile_service_address, 100, 2)) |
This file contains hidden or 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 shutil | |
import requests | |
import time | |
import random | |
# pip install requests-html | |
from requests_html import HTMLSession | |
session = HTMLSession() |
This file contains hidden or 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 workaroud to use clear as a command to clear Command Prompt | |
// Step 1: g++ clear.cpp -o clear.exe | |
// Step 2: Add clear.exe directory to PATH enviroment variable | |
#include<cstdlib> | |
int main() { | |
system("cls"); | |
return 0; | |
} |
This file contains hidden or 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 sys | |
import serial | |
import serial.tools.list_ports as port_list | |
def serial_communication(): | |
ports = list(port_list.comports()) | |
if ports == []: | |
print("No open ports found!") | |
sys.exit() |
This file contains hidden or 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, glob, json | |
import cv2 | |
class BoundingBoxConvertor: | |
def __init__(self): | |
self.label_map = { | |
"0":"class1", | |
"1":"class2", | |
"2":"class3" | |
} |
This file contains hidden or 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 requests | |
headers = { | |
'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" | |
} | |
def get_webpage(): | |
url = "www.google.com" | |
print(url) | |
response = requests.request("GET", url, headers=headers) |
This file contains hidden or 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 cv2 | |
import numpy as np | |
import time | |
greenHSVLowerLimit = (24, 76, 0) | |
greenHSVUpperLimit = (84, 255, 255) | |
VideoStream = cv2.VideoCapture(0) | |
time.sleep(2.0) |
This file contains hidden or 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 cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
image = cv2.imread("sample-images/minions.jpg") | |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) | |
plt.imshow(image) | |
pixel_values = image.reshape((-1, 3)) | |
pixel_values = np.float32(pixel_values) |
This file contains hidden or 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 xml.dom import minidom | |
import os | |
import glob | |
LUT = {"class0": 0, "class1": 1, "class2": 2} | |
def convert_coordinates(size, box): | |
dw = 1.0/size[0] | |
dh = 1.0/size[1] | |
x = (box[0]+box[1])/2.0 |
This file contains hidden or 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 json | |
import cv2 | |
LUT = {"class0": 0, "class1": 1, "class2": 2} | |
for each_file in glob.glob("data/*.json"): | |
with open(each_file) as json_file: | |
data = json.load(json_file)[0] |
NewerOlder