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
{ | |
"public_identifier": "alon-lavian", | |
"profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/alon-lavian/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20230523%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20230523T111453Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=cf270c9149d667b4e1b2124e815f02e1380f03388632b834dfc9c83798e75eb6", | |
"background_cover_image_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/alon-lavian/cover?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20230523%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20230523T111453Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=4fd51e1f1feb5235fafad3a69fefb5c0f4a1b9008a0a036254cc0f7311f2e202", | |
"first_name": "Alon", | |
"last_name": "Lavian", | |
"full_name": "Alon Lavian", | |
"follower_count": null, | |
"occupation": "Director of Product Management at Orca Security", | |
"headline": "Director, Product Management |
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 logging | |
import boto3 | |
from argparse import ArgumentParser, HelpFormatter | |
from botocore.exceptions import ClientError, ProfileNotFound | |
# logger config | |
logger = logging.getLogger() | |
logging.basicConfig(level=logging.INFO, | |
format='%(message)s') |
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 logging | |
import boto3 | |
from argparse import ArgumentParser, HelpFormatter | |
from botocore.exceptions import ClientError, ProfileNotFound | |
# from botocore.errorfactory import UnauthorizedException | |
# logger config | |
logger = logging.getLogger() | |
logging.basicConfig(level=logging.INFO, |
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
architecting.with.gke.workloads.kubernetes.io/safe-to-evict": "true" |
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 tensorflow.keras.applications.vgg16 import VGG16 | |
from tensorflow.keras import layers | |
from tensorflow.keras.models import Model | |
base_model = VGG16(weights='imagenet', #pre-trained weights | |
include_top=False, #remove original classifier | |
input_shape=(HEIGHT, WIDTH, 3)) | |
#Freeze all layers | |
for layer in base_model.layers: |
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 = tf.keras.models.Sequential([ | |
tf.keras.layers.Conv2D(16, (3,3), activation='relu', input_shape=(HEIGHT, WIDTH, 3)), | |
tf.keras.layers.MaxPooling2D(2, 2), | |
tf.keras.layers.Conv2D(32, (3,3), activation='relu'), | |
tf.keras.layers.MaxPooling2D(2,2), | |
tf.keras.layers.Conv2D(64, (3,3), activation='relu'), | |
tf.keras.layers.MaxPooling2D(2,2), | |
tf.keras.layers.Flatten(), | |
tf.keras.layers.Dense(1024, activation='relu'), | |
tf.keras.layers.Dropout(0.2), |
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
original_images_dir = os.fsencode('/content/drive/My Drive/Google Photos/2019') | |
cropped_images_lib = '/content/drive/My Drive/CropMix/' | |
for path, dirs, files in os.walk(original_images_dir): | |
for file in files: | |
image_name = os.fsdecode(file) | |
if image_name.endswith(".jpg"): | |
image_path = os.path.join(path,file) | |
crop_faces(image_path,image_name,cropped_images_lib) |
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 PIL import Image | |
def crop_faces(image_path,image_name,cropped_images_lib): | |
with open(image_path, 'rb') as image: | |
faces = detect_face(image, 8) | |
im = Image.open(image_path) | |
for idx,face in enumerate(faces): | |
vects = face.fd_bounding_poly.vertices |
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 google.cloud import vision | |
from google.cloud.vision import types | |
def detect_face(face_file, max_results=4): | |
client = vision.ImageAnnotatorClient() | |
content = face_file.read() | |
image = types.Image(content=content) | |
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 | |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="/content/drive/My Drive/ML/Misc/vision_service_account.json" |
NewerOlder