Skip to content

Commit

Permalink
Merged PR 548: fix relative links from local Jekyll
Browse files Browse the repository at this point in the history
fix relative links from local Jekyll
  • Loading branch information
lovettchris committed Oct 10, 2017
1 parent 8a6ae84 commit 4697d62
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -3,5 +3,6 @@ source 'https://rubygems.org'
gem 'jekyll'
gem 'jekyll-paginate'
gem 'jekyll-sass-converter'
gem 'jekyll-relative-links'
gem 'kramdown'
gem 'rouge'
7 changes: 7 additions & 0 deletions _config.yml
Expand Up @@ -9,6 +9,8 @@ author:
# url: https://github.com/Microsoft/ELL

# Gems
plugins:
- jekyll-relative-links

destination: ./_site
plugins_dir: ./_plugins
Expand All @@ -17,6 +19,9 @@ data_dir: ./_data

source: docs

relative_links:
enabled: true
collections: false

# Handling Reading
safe: false
Expand Down Expand Up @@ -76,3 +81,5 @@ kramdown:

sass:
sass_dir: _sass


5 changes: 5 additions & 0 deletions docs/_config.yml
Expand Up @@ -9,6 +9,8 @@ author:
# url: https://github.com/Microsoft/ELL

# Gems
plugins:
- jekyll-relative-links

destination: ./_site
plugins_dir: ./_plugins
Expand All @@ -17,6 +19,9 @@ data_dir: ./_data

source: docs

relative_links:
enabled: true
collections: false

# Handling Reading
safe: false
Expand Down
6 changes: 2 additions & 4 deletions docs/css/syntax.scss
Expand Up @@ -3,8 +3,6 @@
# only Main files contain this front matter, not partials.
---

// This file is generated by rougify for the selected theme (DO NOT EDIT)

.highlight table td { padding: 5px; }
.highlight table pre { margin: 0; }
.highlight, .highlight .w {
Expand Down Expand Up @@ -80,8 +78,8 @@
.highlight .nf {
color: #5F0281;
}
.highlight .na {
color: #268bd2;
.highlight .na, .highlight .nb {
color: #0000ff;
}
.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mb, .highlight .mx {
color: #a31515;
Expand Down
2 changes: 1 addition & 1 deletion tools/utilities/pitest/drivetest.py
Expand Up @@ -174,7 +174,7 @@ def find_files_with_extension(self, path, extension):
def get_bash_files(self):
# copy demo files needed to run the test
self.copy_files( [ os.path.join(self.ell_root, "tools/utilities/pitest/coffeemug.jpg"),
os.path.join(self.ell_root, "docs/tutorials/shared/demo.py"),
os.path.join(self.ell_root, "tools/utilities/pythonlibs/demo.py"),
os.path.join(self.ell_root, "tools/utilities/pythonlibs/demoHelper.py") ], self.output_dir)
self.configure_runtest(self.output_dir)

Expand Down
74 changes: 74 additions & 0 deletions tools/utilities/pythonlibs/demo.py
@@ -0,0 +1,74 @@
####################################################################################################
##
## Project: Embedded Learning Library (ELL)
## File: demo.py
## Authors: Chris Lovett
##
## Requires: Python 3.x
##
####################################################################################################

import sys
import os
import numpy as np
import cv2
import demoHelper as d

# note: to run this in headless mode on a Linux machine run the following from your terminal window
# export DISPLAY=:0
# then add the '-save' argument to get tagged frames to be saved to disk.

def main(args):
helper = d.DemoHelper()
helper.parse_arguments(args,
"Runs the given ELL model passing images from camera or static image file\n"
"Either the ELL model file, or the compiled model's Python module must be given,\n"
"using the --model or --compiledModel options respectively.\n"
"Example:\n"
" python demo.py categories.txt --compiledModel tutorial1/pi3/model1\n"
" python demo.py categories.txt --model model1.ell\n"
"This shows opencv window with image classified by the model using given labels")

# Initialize image source
helper.init_image_source()

lastPrediction = ""

while (not helper.done()):
# Grab next frame
frame = helper.get_next_frame()

# Prepare the image to send to the model.
# This involves scaling to the required input dimension and re-ordering from BGR to RGB
data = helper.prepare_image_for_predictor(frame)

# Get the model to classify the image, by returning a list of probabilities for the classes it can detect
predictions = helper.predict(data)

# Get the (at most) top 5 predictions that meet our threshold. This is returned as a list of tuples,
# each with the text label and the prediction score.
top5 = helper.get_top_n_predictions(predictions, 5)

# Turn the top5 into a text string to display
text = ", ".join(["(" + str(int(element[1]*100)) + "%) " + helper.get_label(element[0]) for element in top5])

save = False
if (text != lastPrediction):
print(text)
save = True
lastPrediction = text

# Draw the text on the frame
frameToShow = frame
helper.draw_label(frameToShow, text)
helper.draw_fps(frameToShow)

# Show the new frame
helper.show_image(frameToShow, save)

helper.report_times()

if __name__ == "__main__":
args = sys.argv
args.pop(0) # when an args list is passed to parse_args, the first argument (program name) needs to be dropped
main(args)

0 comments on commit 4697d62

Please sign in to comment.