-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Raphael Badawi
committed
Apr 20, 2021
0 parents
commit 2e8ce37
Showing
15 changed files
with
593 additions
and
0 deletions.
There are no files selected for viewing
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
name: "CaffeNet" | ||
input: "data" | ||
input_dim: 1 | ||
input_dim: 3 | ||
input_dim: 227 | ||
input_dim: 227 | ||
layers { | ||
name: "conv1" | ||
type: CONVOLUTION | ||
bottom: "data" | ||
top: "conv1" | ||
convolution_param { | ||
num_output: 96 | ||
kernel_size: 7 | ||
stride: 4 | ||
} | ||
} | ||
layers { | ||
name: "relu1" | ||
type: RELU | ||
bottom: "conv1" | ||
top: "conv1" | ||
} | ||
layers { | ||
name: "pool1" | ||
type: POOLING | ||
bottom: "conv1" | ||
top: "pool1" | ||
pooling_param { | ||
pool: MAX | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
layers { | ||
name: "norm1" | ||
type: LRN | ||
bottom: "pool1" | ||
top: "norm1" | ||
lrn_param { | ||
local_size: 5 | ||
alpha: 0.0001 | ||
beta: 0.75 | ||
} | ||
} | ||
layers { | ||
name: "conv2" | ||
type: CONVOLUTION | ||
bottom: "norm1" | ||
top: "conv2" | ||
convolution_param { | ||
num_output: 256 | ||
pad: 2 | ||
kernel_size: 5 | ||
} | ||
} | ||
layers { | ||
name: "relu2" | ||
type: RELU | ||
bottom: "conv2" | ||
top: "conv2" | ||
} | ||
layers { | ||
name: "pool2" | ||
type: POOLING | ||
bottom: "conv2" | ||
top: "pool2" | ||
pooling_param { | ||
pool: MAX | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
layers { | ||
name: "norm2" | ||
type: LRN | ||
bottom: "pool2" | ||
top: "norm2" | ||
lrn_param { | ||
local_size: 5 | ||
alpha: 0.0001 | ||
beta: 0.75 | ||
} | ||
} | ||
layers { | ||
name: "conv3" | ||
type: CONVOLUTION | ||
bottom: "norm2" | ||
top: "conv3" | ||
convolution_param { | ||
num_output: 384 | ||
pad: 1 | ||
kernel_size: 3 | ||
} | ||
} | ||
layers{ | ||
name: "relu3" | ||
type: RELU | ||
bottom: "conv3" | ||
top: "conv3" | ||
} | ||
layers { | ||
name: "pool5" | ||
type: POOLING | ||
bottom: "conv3" | ||
top: "pool5" | ||
pooling_param { | ||
pool: MAX | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
layers { | ||
name: "fc6" | ||
type: INNER_PRODUCT | ||
bottom: "pool5" | ||
top: "fc6" | ||
inner_product_param { | ||
num_output: 512 | ||
} | ||
} | ||
layers { | ||
name: "relu6" | ||
type: RELU | ||
bottom: "fc6" | ||
top: "fc6" | ||
} | ||
layers { | ||
name: "drop6" | ||
type: DROPOUT | ||
bottom: "fc6" | ||
top: "fc6" | ||
dropout_param { | ||
dropout_ratio: 0.5 | ||
} | ||
} | ||
layers { | ||
name: "fc7" | ||
type: INNER_PRODUCT | ||
bottom: "fc6" | ||
top: "fc7" | ||
inner_product_param { | ||
num_output: 512 | ||
} | ||
} | ||
layers { | ||
name: "relu7" | ||
type: RELU | ||
bottom: "fc7" | ||
top: "fc7" | ||
} | ||
layers { | ||
name: "drop7" | ||
type: DROPOUT | ||
bottom: "fc7" | ||
top: "fc7" | ||
dropout_param { | ||
dropout_ratio: 0.5 | ||
} | ||
} | ||
layers { | ||
name: "fc8" | ||
type: INNER_PRODUCT | ||
bottom: "fc7" | ||
top: "fc8" | ||
inner_product_param { | ||
num_output: 8 | ||
} | ||
} | ||
layers { | ||
name: "prob" | ||
type: SOFTMAX | ||
bottom: "fc8" | ||
top: "prob" | ||
} |
Binary file not shown.
Binary file not shown.
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"class_name": "Sequential", "backend": "tensorflow", "config": [{"class_name": "Conv2D", "config": {"dtype": "float32", "padding": "valid", "filters": 64, "trainable": true, "activation": "relu", "bias_constraint": null, "strides": [1, 1], "name": "conv2d_1", "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_constraint": null, "kernel_regularizer": null, "data_format": "channels_last", "use_bias": true, "batch_input_shape": [null, 48, 48, 1], "activity_regularizer": null, "kernel_size": [5, 5], "bias_initializer": {"class_name": "Zeros", "config": {}}}}, {"class_name": "MaxPooling2D", "config": {"name": "max_pooling2d_1", "padding": "valid", "pool_size": [5, 5], "data_format": "channels_last", "trainable": true, "strides": [2, 2]}}, {"class_name": "Conv2D", "config": {"padding": "valid", "filters": 64, "trainable": true, "activation": "relu", "bias_constraint": null, "strides": [1, 1], "name": "conv2d_2", "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_constraint": null, "kernel_regularizer": null, "data_format": "channels_last", "use_bias": true, "activity_regularizer": null, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}}}, {"class_name": "Conv2D", "config": {"padding": "valid", "filters": 64, "trainable": true, "activation": "relu", "bias_constraint": null, "strides": [1, 1], "name": "conv2d_3", "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_constraint": null, "kernel_regularizer": null, "data_format": "channels_last", "use_bias": true, "activity_regularizer": null, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}}}, {"class_name": "AveragePooling2D", "config": {"name": "average_pooling2d_1", "padding": "valid", "pool_size": [3, 3], "data_format": "channels_last", "trainable": true, "strides": [2, 2]}}, {"class_name": "Conv2D", "config": {"padding": "valid", "filters": 128, "trainable": true, "activation": "relu", "bias_constraint": null, "strides": [1, 1], "name": "conv2d_4", "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_constraint": null, "kernel_regularizer": null, "data_format": "channels_last", "use_bias": true, "activity_regularizer": null, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}}}, {"class_name": "Conv2D", "config": {"padding": "valid", "filters": 128, "trainable": true, "activation": "relu", "bias_constraint": null, "strides": [1, 1], "name": "conv2d_5", "dilation_rate": [1, 1], "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_constraint": null, "kernel_regularizer": null, "data_format": "channels_last", "use_bias": true, "activity_regularizer": null, "kernel_size": [3, 3], "bias_initializer": {"class_name": "Zeros", "config": {}}}}, {"class_name": "AveragePooling2D", "config": {"name": "average_pooling2d_2", "padding": "valid", "pool_size": [3, 3], "data_format": "channels_last", "trainable": true, "strides": [2, 2]}}, {"class_name": "Flatten", "config": {"name": "flatten_1", "trainable": true}}, {"class_name": "Dense", "config": {"use_bias": true, "trainable": true, "activation": "relu", "activity_regularizer": null, "name": "dense_1", "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_regularizer": null, "units": 1024, "bias_constraint": null, "kernel_constraint": null, "bias_initializer": {"class_name": "Zeros", "config": {}}}}, {"class_name": "Dropout", "config": {"name": "dropout_1", "trainable": true, "rate": 0.2}}, {"class_name": "Dense", "config": {"use_bias": true, "trainable": true, "activation": "relu", "activity_regularizer": null, "name": "dense_2", "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_regularizer": null, "units": 1024, "bias_constraint": null, "kernel_constraint": null, "bias_initializer": {"class_name": "Zeros", "config": {}}}}, {"class_name": "Dropout", "config": {"name": "dropout_2", "trainable": true, "rate": 0.2}}, {"class_name": "Dense", "config": {"use_bias": true, "trainable": true, "activation": "softmax", "activity_regularizer": null, "name": "dense_3", "kernel_initializer": {"class_name": "VarianceScaling", "config": {"distribution": "uniform", "mode": "fan_avg", "scale": 1.0, "seed": null}}, "bias_regularizer": null, "kernel_regularizer": null, "units": 7, "bias_constraint": null, "kernel_constraint": null, "bias_initializer": {"class_name": "Zeros", "config": {}}}}], "keras_version": "2.0.8"} |
Binary file not shown.
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
name: "CaffeNet" | ||
input: "data" | ||
input_dim: 10 | ||
input_dim: 3 | ||
input_dim: 227 | ||
input_dim: 227 | ||
layers { | ||
name: "conv1" | ||
type: CONVOLUTION | ||
bottom: "data" | ||
top: "conv1" | ||
convolution_param { | ||
num_output: 96 | ||
kernel_size: 7 | ||
stride: 4 | ||
} | ||
} | ||
layers { | ||
name: "relu1" | ||
type: RELU | ||
bottom: "conv1" | ||
top: "conv1" | ||
} | ||
layers { | ||
name: "pool1" | ||
type: POOLING | ||
bottom: "conv1" | ||
top: "pool1" | ||
pooling_param { | ||
pool: MAX | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
layers { | ||
name: "norm1" | ||
type: LRN | ||
bottom: "pool1" | ||
top: "norm1" | ||
lrn_param { | ||
local_size: 5 | ||
alpha: 0.0001 | ||
beta: 0.75 | ||
} | ||
} | ||
layers { | ||
name: "conv2" | ||
type: CONVOLUTION | ||
bottom: "norm1" | ||
top: "conv2" | ||
convolution_param { | ||
num_output: 256 | ||
pad: 2 | ||
kernel_size: 5 | ||
} | ||
} | ||
layers { | ||
name: "relu2" | ||
type: RELU | ||
bottom: "conv2" | ||
top: "conv2" | ||
} | ||
layers { | ||
name: "pool2" | ||
type: POOLING | ||
bottom: "conv2" | ||
top: "pool2" | ||
pooling_param { | ||
pool: MAX | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
layers { | ||
name: "norm2" | ||
type: LRN | ||
bottom: "pool2" | ||
top: "norm2" | ||
lrn_param { | ||
local_size: 5 | ||
alpha: 0.0001 | ||
beta: 0.75 | ||
} | ||
} | ||
layers { | ||
name: "conv3" | ||
type: CONVOLUTION | ||
bottom: "norm2" | ||
top: "conv3" | ||
convolution_param { | ||
num_output: 384 | ||
pad: 1 | ||
kernel_size: 3 | ||
} | ||
} | ||
layers{ | ||
name: "relu3" | ||
type: RELU | ||
bottom: "conv3" | ||
top: "conv3" | ||
} | ||
layers { | ||
name: "pool5" | ||
type: POOLING | ||
bottom: "conv3" | ||
top: "pool5" | ||
pooling_param { | ||
pool: MAX | ||
kernel_size: 3 | ||
stride: 2 | ||
} | ||
} | ||
layers { | ||
name: "fc6" | ||
type: INNER_PRODUCT | ||
bottom: "pool5" | ||
top: "fc6" | ||
inner_product_param { | ||
num_output: 512 | ||
} | ||
} | ||
layers { | ||
name: "relu6" | ||
type: RELU | ||
bottom: "fc6" | ||
top: "fc6" | ||
} | ||
layers { | ||
name: "drop6" | ||
type: DROPOUT | ||
bottom: "fc6" | ||
top: "fc6" | ||
dropout_param { | ||
dropout_ratio: 0.5 | ||
} | ||
} | ||
layers { | ||
name: "fc7" | ||
type: INNER_PRODUCT | ||
bottom: "fc6" | ||
top: "fc7" | ||
inner_product_param { | ||
num_output: 512 | ||
} | ||
} | ||
layers { | ||
name: "relu7" | ||
type: RELU | ||
bottom: "fc7" | ||
top: "fc7" | ||
} | ||
layers { | ||
name: "drop7" | ||
type: DROPOUT | ||
bottom: "fc7" | ||
top: "fc7" | ||
dropout_param { | ||
dropout_ratio: 0.5 | ||
} | ||
} | ||
layers { | ||
name: "fc8" | ||
type: INNER_PRODUCT | ||
bottom: "fc7" | ||
top: "fc8" | ||
inner_product_param { | ||
num_output: 2 | ||
} | ||
} | ||
layers { | ||
name: "prob" | ||
type: SOFTMAX | ||
bottom: "fc8" | ||
top: "prob" | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import cv2 | ||
import face_recognition | ||
|
||
image_to_detect = cv2.imread("images/veran2.png") | ||
|
||
all_face_locations = face_recognition.face_locations( | ||
image_to_detect, model="hog") | ||
|
||
print("There are {} faces detected in this image".format(len(all_face_locations))) | ||
|
||
for index, current_face_location in enumerate(all_face_locations): | ||
top_pos, right_pos, bottom_pos, left_pos = current_face_location | ||
print("Found face {} at top: {}, right: {}, bottom: {}, left: {}".format( | ||
index + 1, top_pos, right_pos, bottom_pos, left_pos)) | ||
current_face_image = image_to_detect[top_pos:bottom_pos, | ||
left_pos:right_pos] | ||
cv2.imshow("Face n" + str(index), current_face_image) | ||
cv2.waitKey(0) | ||
cv2.destroyAllWindows() |
Oops, something went wrong.