Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Siamese model #11

Merged
merged 12 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,13 @@ Images/**
**/cmake_install.cmake
**/CMakeCache.txt
camera
CMakeFiles/**
**/.env
src/lfwa/**
**/__pycache__/**
src/model/message/__pycache__/**
src/model/__pycache__/utils.cpython-38.pyc
src/model/message/__pycache__/__init__.cpython-38.pyc
src/model/message/__pycache__/sms_message.cpython-38.pyc
**/Makefile
src/lfwa/**
192 changes: 0 additions & 192 deletions Makefile

This file was deleted.

15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
Make sure git-clang-format is installed with `npm install -g clang-format`
1. Call `clang-format.sh` under ci/
2. `git add` and `git commit`!
To run:

## To run

`cd build`

Expand All @@ -15,3 +16,15 @@ To run:
`make`

`./camera`

## Setting up Twilio

- `cd` to `src/message/`

- Make a `.env` file with `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` set to your account SID and Auth Token

- macOS: `brew tap twilio/brew && brew install twilio`

- `twilio login`

- `pip install twilio`
Binary file removed camera
Binary file not shown.
134 changes: 0 additions & 134 deletions src/Makefile

This file was deleted.

12 changes: 7 additions & 5 deletions src/model/Siamese_Network.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from sklearn.model_selection import train_test_split

import os
import pickle
import random

import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split

from tensorflow.keras import Input, Sequential, Model
from tensorflow.keras import backend as K
from tensorflow.keras.callbacks import EarlyStopping
Expand Down Expand Up @@ -279,10 +281,10 @@ def evaluate(self, test_file, batch_size, analyze=False):
def predict(self, x_test, names):
prob = self.siamese_net.predict(x_test)

for pair_index in range(len(names)):
name = names[pair_index]
pair_prob = prob[pair_index][0]
print(f"Similar to {name} with probability: ", pair_prob)
name = names[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally should use for loop to loop over all elements, rather than predicting only on one element

pair_prob = prob[0][0]
print(f"Similar to {name} with probability: ", pair_prob)
return pair_prob

def _analyze(self, x_test, y_test, names):
"""
Expand Down
Loading