suvadityamuk
commited on
Commit
•
fc1f1b8
1
Parent(s):
2b5a403
added dataset and made corrections
Browse filesSigned-off-by: Suvaditya Mukherjee <suvadityamuk@gmail.com>
This view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- app.py +11 -10
- celeb_dataset/Angelina Jolie/001_fe3347c0.jpg +3 -0
- celeb_dataset/Angelina Jolie/002_8f8da10e.jpg +3 -0
- celeb_dataset/Angelina Jolie/003_57612506.jpg +3 -0
- celeb_dataset/Angelina Jolie/004_f61e7d0c.jpg +3 -0
- celeb_dataset/Angelina Jolie/005_582c121a.jpg +3 -0
- celeb_dataset/Brad Pitt/001_c04300ef.jpg +3 -0
- celeb_dataset/Brad Pitt/002_cc1b9701.jpg +3 -0
- celeb_dataset/Brad Pitt/003_7a6b2156.jpg +3 -0
- celeb_dataset/Brad Pitt/004_777c50d0.jpg +3 -0
- celeb_dataset/Brad Pitt/005_02ab3a1b.jpg +3 -0
- celeb_dataset/Denzel Washington/001_d3323f3c.jpg +3 -0
- celeb_dataset/Denzel Washington/002_f44b8d45.jpg +3 -0
- celeb_dataset/Denzel Washington/003_b622e925.jpg +3 -0
- celeb_dataset/Denzel Washington/004_677c65bf.jpg +3 -0
- celeb_dataset/Denzel Washington/005_cb37c7b2.jpg +3 -0
- celeb_dataset/Hugh Jackman/001_9adc92c2.jpg +3 -0
- celeb_dataset/Hugh Jackman/002_85eab275.jpg +3 -0
- celeb_dataset/Hugh Jackman/003_8889ec2c.jpg +3 -0
- celeb_dataset/Hugh Jackman/004_41caa173.jpg +3 -0
- celeb_dataset/Hugh Jackman/005_3ba56da0.jpg +3 -0
- celeb_dataset/Jennifer Lawrence/001_21a7d5e6.jpg +3 -0
- celeb_dataset/Jennifer Lawrence/002_533748b2.jpg +3 -0
- celeb_dataset/Jennifer Lawrence/003_963a3627.jpg +3 -0
- celeb_dataset/Jennifer Lawrence/004_94f26ed9.jpg +3 -0
- celeb_dataset/Jennifer Lawrence/005_7f198c47.jpg +3 -0
- celeb_dataset/Johnny Depp/001_2288a4f6.jpg +3 -0
- celeb_dataset/Johnny Depp/002_331d0423.jpg +3 -0
- celeb_dataset/Johnny Depp/003_64926b97.jpg +3 -0
- celeb_dataset/Johnny Depp/004_18e08ab4.jpg +3 -0
- celeb_dataset/Johnny Depp/005_9406f32d.jpg +3 -0
- celeb_dataset/Kate Winslet/001_5992faf7.jpg +3 -0
- celeb_dataset/Kate Winslet/002_590bb980.jpg +3 -0
- celeb_dataset/Kate Winslet/003_acb20793.jpg +3 -0
- celeb_dataset/Kate Winslet/004_0816d969.jpg +3 -0
- celeb_dataset/Kate Winslet/005_93b2fce9.jpg +3 -0
- celeb_dataset/Leonardo DiCaprio/001_08194468.jpg +3 -0
- celeb_dataset/Leonardo DiCaprio/002_86e8aa58.jpg +3 -0
- celeb_dataset/Leonardo DiCaprio/003_85990366.jpg +3 -0
- celeb_dataset/Leonardo DiCaprio/004_af012af1.jpg +3 -0
- celeb_dataset/Leonardo DiCaprio/005_7fe5b764.jpg +3 -0
- celeb_dataset/Megan Fox/001_dfb62d96.jpg +3 -0
- celeb_dataset/Megan Fox/002_6e289116.jpg +3 -0
- celeb_dataset/Megan Fox/003_61dd1e53.jpg +3 -0
- celeb_dataset/Megan Fox/004_6aede3d3.jpg +3 -0
- celeb_dataset/Megan Fox/005_9574c208.jpg +3 -0
- celeb_dataset/Natalie Portman/001_9cd1160a.jpg +3 -0
- celeb_dataset/Natalie Portman/002_3a2ef5df.jpg +3 -0
- celeb_dataset/Natalie Portman/003_13b7bb9d.jpg +3 -0
.gitattributes
CHANGED
@@ -37,3 +37,4 @@ openface.nn4.small2.v1.t7 filter=lfs diff=lfs merge=lfs -text
|
|
37 |
res10_300x300_ssd_iter_140000.caffemodel filter=lfs diff=lfs merge=lfs -text
|
38 |
unknownEmbeddings.pkl filter=lfs diff=lfs merge=lfs -text
|
39 |
unknownNames.pkl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
37 |
res10_300x300_ssd_iter_140000.caffemodel filter=lfs diff=lfs merge=lfs -text
|
38 |
unknownEmbeddings.pkl filter=lfs diff=lfs merge=lfs -text
|
39 |
unknownNames.pkl filter=lfs diff=lfs merge=lfs -text
|
40 |
+
celeb_dataset/** filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -13,15 +13,17 @@ from imutils import resize
|
|
13 |
|
14 |
def calc_embeddings(all_files, names):
|
15 |
detector = cv2.dnn.readNetFromCaffe(
|
16 |
-
"deploy.prototxt.txt", "res10_300x300_ssd_iter_140000.caffemodel"
|
17 |
)
|
18 |
-
embedder = cv2.dnn.readNetFromTorch("openface.nn4.small2.v1.t7")
|
19 |
knownNames = []
|
20 |
knownEmbeddings = []
|
21 |
total = 0
|
22 |
for file in all_files:
|
23 |
name = names[total]
|
24 |
-
|
|
|
|
|
25 |
file_bytes = np.asarray(bytearray(f.read()), dtype=np.uint8)
|
26 |
image = cv2.imdecode(file_bytes, 1)
|
27 |
image = resize(image, width=600)
|
@@ -58,9 +60,9 @@ def calc_embeddings(all_files, names):
|
|
58 |
knownNames.append(name)
|
59 |
knownEmbeddings.append(vec.flatten())
|
60 |
total += 1
|
61 |
-
with open("
|
62 |
l = pickle.load(fp)
|
63 |
-
with open("
|
64 |
n = pickle.load(fp)
|
65 |
for i in l:
|
66 |
knownEmbeddings.append(i)
|
@@ -80,7 +82,7 @@ def recognize(embeddings, names):
|
|
80 |
|
81 |
def run_inference(myImage):
|
82 |
|
83 |
-
os.chdir("
|
84 |
celebs = []
|
85 |
scores = dict()
|
86 |
|
@@ -96,12 +98,11 @@ def run_inference(myImage):
|
|
96 |
names.append(name)
|
97 |
embeddings, names = calc_embeddings(files, names)
|
98 |
le, model = recognize(embeddings, names)
|
99 |
-
|
100 |
detector = cv2.dnn.readNetFromCaffe(
|
101 |
-
"
|
102 |
-
"
|
103 |
)
|
104 |
-
embedder = cv2.dnn.readNetFromTorch("
|
105 |
(h, w) = myImage.shape[:2]
|
106 |
imageBlob = cv2.dnn.blobFromImage(
|
107 |
cv2.resize(myImage, (300, 300)),
|
|
|
13 |
|
14 |
def calc_embeddings(all_files, names):
|
15 |
detector = cv2.dnn.readNetFromCaffe(
|
16 |
+
"../deploy.prototxt.txt", "../res10_300x300_ssd_iter_140000.caffemodel"
|
17 |
)
|
18 |
+
embedder = cv2.dnn.readNetFromTorch("../openface.nn4.small2.v1.t7")
|
19 |
knownNames = []
|
20 |
knownEmbeddings = []
|
21 |
total = 0
|
22 |
for file in all_files:
|
23 |
name = names[total]
|
24 |
+
path = os.path.join(os.getcwd(), name, file)
|
25 |
+
# f = open(f"/celeb_dataset/'{name}'/{file}", "rb")
|
26 |
+
f = open(path, "rb")
|
27 |
file_bytes = np.asarray(bytearray(f.read()), dtype=np.uint8)
|
28 |
image = cv2.imdecode(file_bytes, 1)
|
29 |
image = resize(image, width=600)
|
|
|
60 |
knownNames.append(name)
|
61 |
knownEmbeddings.append(vec.flatten())
|
62 |
total += 1
|
63 |
+
with open("../unknownEmbeddings.pkl", "rb") as fp:
|
64 |
l = pickle.load(fp)
|
65 |
+
with open("../unknownNames.pkl", "rb") as fp:
|
66 |
n = pickle.load(fp)
|
67 |
for i in l:
|
68 |
knownEmbeddings.append(i)
|
|
|
82 |
|
83 |
def run_inference(myImage):
|
84 |
|
85 |
+
os.chdir("celeb_dataset")
|
86 |
celebs = []
|
87 |
scores = dict()
|
88 |
|
|
|
98 |
names.append(name)
|
99 |
embeddings, names = calc_embeddings(files, names)
|
100 |
le, model = recognize(embeddings, names)
|
|
|
101 |
detector = cv2.dnn.readNetFromCaffe(
|
102 |
+
"../deploy.prototxt.txt",
|
103 |
+
"../res10_300x300_ssd_iter_140000.caffemodel",
|
104 |
)
|
105 |
+
embedder = cv2.dnn.readNetFromTorch("../openface.nn4.small2.v1.t7")
|
106 |
(h, w) = myImage.shape[:2]
|
107 |
imageBlob = cv2.dnn.blobFromImage(
|
108 |
cv2.resize(myImage, (300, 300)),
|
celeb_dataset/Angelina Jolie/001_fe3347c0.jpg
ADDED
Git LFS Details
|
celeb_dataset/Angelina Jolie/002_8f8da10e.jpg
ADDED
Git LFS Details
|
celeb_dataset/Angelina Jolie/003_57612506.jpg
ADDED
Git LFS Details
|
celeb_dataset/Angelina Jolie/004_f61e7d0c.jpg
ADDED
Git LFS Details
|
celeb_dataset/Angelina Jolie/005_582c121a.jpg
ADDED
Git LFS Details
|
celeb_dataset/Brad Pitt/001_c04300ef.jpg
ADDED
Git LFS Details
|
celeb_dataset/Brad Pitt/002_cc1b9701.jpg
ADDED
Git LFS Details
|
celeb_dataset/Brad Pitt/003_7a6b2156.jpg
ADDED
Git LFS Details
|
celeb_dataset/Brad Pitt/004_777c50d0.jpg
ADDED
Git LFS Details
|
celeb_dataset/Brad Pitt/005_02ab3a1b.jpg
ADDED
Git LFS Details
|
celeb_dataset/Denzel Washington/001_d3323f3c.jpg
ADDED
Git LFS Details
|
celeb_dataset/Denzel Washington/002_f44b8d45.jpg
ADDED
Git LFS Details
|
celeb_dataset/Denzel Washington/003_b622e925.jpg
ADDED
Git LFS Details
|
celeb_dataset/Denzel Washington/004_677c65bf.jpg
ADDED
Git LFS Details
|
celeb_dataset/Denzel Washington/005_cb37c7b2.jpg
ADDED
Git LFS Details
|
celeb_dataset/Hugh Jackman/001_9adc92c2.jpg
ADDED
Git LFS Details
|
celeb_dataset/Hugh Jackman/002_85eab275.jpg
ADDED
Git LFS Details
|
celeb_dataset/Hugh Jackman/003_8889ec2c.jpg
ADDED
Git LFS Details
|
celeb_dataset/Hugh Jackman/004_41caa173.jpg
ADDED
Git LFS Details
|
celeb_dataset/Hugh Jackman/005_3ba56da0.jpg
ADDED
Git LFS Details
|
celeb_dataset/Jennifer Lawrence/001_21a7d5e6.jpg
ADDED
Git LFS Details
|
celeb_dataset/Jennifer Lawrence/002_533748b2.jpg
ADDED
Git LFS Details
|
celeb_dataset/Jennifer Lawrence/003_963a3627.jpg
ADDED
Git LFS Details
|
celeb_dataset/Jennifer Lawrence/004_94f26ed9.jpg
ADDED
Git LFS Details
|
celeb_dataset/Jennifer Lawrence/005_7f198c47.jpg
ADDED
Git LFS Details
|
celeb_dataset/Johnny Depp/001_2288a4f6.jpg
ADDED
Git LFS Details
|
celeb_dataset/Johnny Depp/002_331d0423.jpg
ADDED
Git LFS Details
|
celeb_dataset/Johnny Depp/003_64926b97.jpg
ADDED
Git LFS Details
|
celeb_dataset/Johnny Depp/004_18e08ab4.jpg
ADDED
Git LFS Details
|
celeb_dataset/Johnny Depp/005_9406f32d.jpg
ADDED
Git LFS Details
|
celeb_dataset/Kate Winslet/001_5992faf7.jpg
ADDED
Git LFS Details
|
celeb_dataset/Kate Winslet/002_590bb980.jpg
ADDED
Git LFS Details
|
celeb_dataset/Kate Winslet/003_acb20793.jpg
ADDED
Git LFS Details
|
celeb_dataset/Kate Winslet/004_0816d969.jpg
ADDED
Git LFS Details
|
celeb_dataset/Kate Winslet/005_93b2fce9.jpg
ADDED
Git LFS Details
|
celeb_dataset/Leonardo DiCaprio/001_08194468.jpg
ADDED
Git LFS Details
|
celeb_dataset/Leonardo DiCaprio/002_86e8aa58.jpg
ADDED
Git LFS Details
|
celeb_dataset/Leonardo DiCaprio/003_85990366.jpg
ADDED
Git LFS Details
|
celeb_dataset/Leonardo DiCaprio/004_af012af1.jpg
ADDED
Git LFS Details
|
celeb_dataset/Leonardo DiCaprio/005_7fe5b764.jpg
ADDED
Git LFS Details
|
celeb_dataset/Megan Fox/001_dfb62d96.jpg
ADDED
Git LFS Details
|
celeb_dataset/Megan Fox/002_6e289116.jpg
ADDED
Git LFS Details
|
celeb_dataset/Megan Fox/003_61dd1e53.jpg
ADDED
Git LFS Details
|
celeb_dataset/Megan Fox/004_6aede3d3.jpg
ADDED
Git LFS Details
|
celeb_dataset/Megan Fox/005_9574c208.jpg
ADDED
Git LFS Details
|
celeb_dataset/Natalie Portman/001_9cd1160a.jpg
ADDED
Git LFS Details
|
celeb_dataset/Natalie Portman/002_3a2ef5df.jpg
ADDED
Git LFS Details
|
celeb_dataset/Natalie Portman/003_13b7bb9d.jpg
ADDED
Git LFS Details
|