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 json | |
import subprocess | |
import os | |
# Base directory where Terraform configurations will be saved | |
base_output_dir = 'terraform_roles_policies' | |
#policies_dir = os.path.join(base_output_dir, 'policies') | |
# Create directories if they don't exist | |
#os.makedirs(policies_dir, exist_ok=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.models import load_model | |
import tensorflow as tf | |
from tensorflow.keras.preprocessing import image | |
from tensorflow.keras.applications.vgg16 import preprocess_input, decode_predictions | |
import numpy as np | |
import json | |
model = load_model('vggK5-weights-best.h5') |
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 pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import os | |
from PIL import Image | |
import re | |
import json | |
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
$ python3 vgg.py | |
Found 758 images belonging to 19 classes. | |
Found 180 images belonging to 19 classes. | |
2020-09-17 14:42:07.878829: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA | |
2020-09-17 14:42:07.901823: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fbe0c406470 initialized for platform Host (this does not guarantee that XLA will be used). Devices: | |
2020-09-17 14:42:07.901927: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version | |
Model: "model" | |
_________________________________________________________________ | |
Layer (type) Output Shape Param # | |
================================================================= |
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
acc = history.history['accuracy'] | |
val_acc = history.history['val_accuracy'] | |
loss=history.history['loss'] | |
val_loss=history.history['val_loss'] | |
epochs_range = range(epochs) | |
plt.figure(figsize=(8, 8)) | |
plt.subplot(1, 2, 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
model.compile(optimizer = 'adam', loss = 'categorical_crossentropy', metrics = ['accuracy']) | |
model.summary() | |
history = model.fit( | |
x = training_set, | |
epochs=epochs, | |
validation_data=test_set | |
) |
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 = Sequential() | |
model.add(Conv2D(32, kernel_size=(3, 3), activation=tf.keras.layers.LeakyReLU(alpha=0.3), input_shape=(IMG_HEIGHT,IMG_WIDTH , 3))) | |
model.add(Conv2D(32, (3, 3), activation=tf.keras.layers.LeakyReLU(alpha=0.3))) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Dropout(0.25)) | |
model.add(Conv2D(64, kernel_size=(3, 3), activation=tf.keras.layers.LeakyReLU(alpha=0.3))) | |
model.add(Conv2D(64, (3, 3), activation=tf.keras.layers.LeakyReLU(alpha=0.3))) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Dropout(0.25)) |
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.layers import Dense, Conv2D, Flatten, Dropout, MaxPooling2D | |
from tensorflow.keras.preprocessing.image import ImageDataGenerator | |
import tensorflow as tf | |
import os | |
import numpy as np | |
import matplotlib.pyplot as plt | |
batch_size = 24 | |
epochs = 200 | |
IMG_HEIGHT = 150 |
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.resnet50 import ResNet50 | |
from tensorflow.keras.preprocessing import image | |
from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions | |
import numpy as np | |
model = ResNet50(weights='imagenet') | |
img_path = 'boris-smokrovic-Ori_JWlqVpc-unsplash.jpg' | |
img = image.load_img(img_path, target_size=(224, 224)) | |
x = image.img_to_array(img) | |
x = np.expand_dims(x, axis=0) | |
x = preprocess_input(x) |
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 os import walk | |
import numpy as np | |
import argparse | |
import time | |
import cv2 | |
import os | |
import re | |
# construct the argument parse and parse the arguments |