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

Created model to recognise UFO sightings #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions ufo_model/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Steps:

This folder contains output_labels.txt and output_graph.pb

THis model has retrained on classes of UFO sightings:
* spotlight
* roundworm
* nematode


We scraped images from ufostalker website. We then found 3 most occuring classes. We wanted to have more images per class.

We retrain an already existing model based on our images. the steps for those are found here:
https://www.tensorflow.org/tutorials/image_retraining

Requirements: tensorflow

## Steps for UFO sightings:
1. Create directory structure such that images of given class are in single folder. all these folders are within main folder.

2. Next run the steps mentioned in tutorial using retraining.py

Choose a reason for hiding this comment

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

retrain.py we run this script on our classes folder to retrain the last layer using this command
python retrain.py --image_dir Path-To-UFO-new-classes-folder

Note: retrain.py throws an error if GIF, TIFF images are used. Hence it is suggested to use JPEG or PNG Images.


3. This will give you output_labels.txt and output_graph.pb

Choose a reason for hiding this comment

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

We used this command to test the retrained model:
python label_image.py --graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt --input_layer=Mul --output_layer=final_result --input_mean=128 --input_std=128 --image=/Users/prerana/Desktop/image2.JPG

Note: Command in the tutorial needs to be modified as above to use the default input layer name since we have not specified it explicitly. Otherwise Tensorflow will throw the follwoing error:
KeyError: "The name 'import/Placeholder' refers to an Operation not in the graph."

The image used is to test is taken from the following URL from ufo-stalker.com:
https://www.mufoncms.com/files_jeud8334j/91316_submitter_file1__IMG0414.JPG [I have saved it as image2.JPG]

These were the results obtained:
spotlight 0.9694056
roundworm 0.021185338
nematode 0.009408991

Attaching Picture:
screen shot 2018-04-14 at 8 12 37 am

After this you can use the model to test on a new image. Sample command is:
python label_image.py \
Copy link

@prenastro prenastro Apr 14, 2018

Choose a reason for hiding this comment

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

This command has been changed. Please refer above

--graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt \
--input_layer=Placeholder \
--output_layer=final_result \
--image=<test_image_path>
Binary file added ufo_model/output_graph.pb
Binary file not shown.
3 changes: 3 additions & 0 deletions ufo_model/output_labels.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nematode worm
roundworm
spotlight