This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
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.
Add files for initial release with pre-generated model files
- Loading branch information
Showing
8 changed files
with
140 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
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,5 @@ | ||
# Changelog | ||
|
||
# v0.1.0 | ||
|
||
Initial release. |
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,2 @@ | ||
[pytest] | ||
testpaths = test |
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,51 @@ | ||
#!/bin/sh -e | ||
|
||
cd $(dirname "$0") | ||
|
||
graph_file="../target_finder_model/data/graph.pb" | ||
labels_file="../target_finder_model/data/labels.txt" | ||
|
||
# Check that the model files exist. | ||
[ -f "$graph_file" ] || (>&2 echo "Missing graph.pb" && exit 1) | ||
[ -f "$labels_file" ] || (>&2 echo "Missing labels.txt" && exit 1) | ||
|
||
# Find the version number to release. | ||
version=$(grep -o -e "'.*'" "../target_finder_model/version.py" | tr -d "'") | ||
|
||
echo "Detected version ""$version" | ||
|
||
tf_stage_dir="../release/staging/target-finder-model" | ||
archive_name="target-finder-model-""$version"".tar.gz" | ||
|
||
# Create the staging directory and the target-finder folder. | ||
echo "Staging files" | ||
mkdir -p "$tf_stage_dir" | ||
|
||
# Copy over python files. | ||
mkdir -p "$tf_stage_dir""/target_finder_model" | ||
find "../target_finder_model/" -name "*.py" -exec cp "{}" \ | ||
"$tf_stage_dir/target_finder_model/" \; | ||
|
||
# Copy over the graph and labels. | ||
mkdir -p "$tf_stage_dir""/target_finder_model/data" | ||
cp "$graph_file" "$tf_stage_dir""/target_finder_model/data/" | ||
cp "$labels_file" "$tf_stage_dir""/target_finder_model/data/" | ||
|
||
# Copy over configuration and informational files. | ||
cp ../README.md ../LICENSE \ | ||
../setup.py "$tf_stage_dir" | ||
|
||
# Compress the directory. | ||
echo "Creating archive" | ||
|
||
cd "../release/staging" | ||
tar -czvf "$archive_name" "target-finder-model" | ||
mv "$archive_name" .. | ||
|
||
echo "\033[32mCreated target-finder-model release" \ | ||
"(""$archive_name"")\033[0m" | ||
|
||
# Remove the staging directory. | ||
echo "Removing staging files" | ||
cd .. | ||
rm -rf staging |
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,51 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
|
||
try: | ||
from setuptools import setup, find_packages | ||
except: | ||
raise Exception('setuptools is required for installation') | ||
|
||
|
||
def join(*paths): | ||
"""Join and normalize several paths. | ||
Args: | ||
*paths (List[str]): The paths to join and normalize. | ||
Returns: | ||
str: The normalized path. | ||
""" | ||
|
||
return os.path.normpath(os.path.join(*paths)) | ||
|
||
|
||
VERSION_PATH = join(__file__, '..', 'target_finder_model', 'version.py') | ||
|
||
|
||
def get_version(): | ||
"""Get the version number without running version.py. | ||
Returns: | ||
str: The current uavaustin-target-finder version. | ||
""" | ||
|
||
with open(VERSION_PATH, 'r') as version: | ||
out = {} | ||
|
||
exec(version.read(), out) | ||
|
||
return out['__version__'] | ||
|
||
|
||
setup( | ||
name='target-finder-model', | ||
version=get_version(), | ||
author='UAV Austin', | ||
url='https://github.com/uavaustin/target-finder-model', | ||
packages=find_packages(), | ||
package_data={ | ||
'target_finder_model': [ | ||
'data/graph.pb', 'data/labels.txt' | ||
] | ||
}, | ||
license='MIT' | ||
) |
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,11 @@ | ||
"""Entrypoint for the target_finder_model library. | ||
This module contains the filenames used for target-finder so they can | ||
be encapsulated in a single python library that can be fetched. | ||
""" | ||
|
||
from pkg_resources import resource_filename | ||
|
||
|
||
graph_file = resource_filename(__name__, 'data/graph.pb') | ||
labels_file = resource_filename(__name__, 'data/labels.txt') |
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 @@ | ||
__version__ = '0.1.0' |
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,13 @@ | ||
"""Testing that the files can be accessed and are non-empty.""" | ||
|
||
import os | ||
|
||
import target_finder_model | ||
|
||
|
||
def test_graph_file(): | ||
assert os.path.getsize(target_finder_model.graph_file) > 0 | ||
|
||
|
||
def test_label_file(): | ||
assert os.path.getsize(target_finder_model.labels_file) > 0 |