This repository has been archived by the owner on Feb 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eaffbbf
commit 2dd9e00
Showing
2 changed files
with
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
import numpy as np | ||
from gnes.encoder.image.inception import TFInceptionEncoder | ||
import unittest | ||
|
||
|
||
class TestTFImageEncoder(unittest.TestCase): | ||
def setUp(self): | ||
dirname = os.path.dirname(__file__) | ||
self.yaml_path = os.path.join(dirname, 'yaml', 'tf-inception-encoder.yaml') | ||
self.test_data_1 = [np.random.uniform(0, 1, size=(299, 299, 3)).astype(np.uint8) for _ in range(1)] | ||
self.test_data_2 = [np.random.uniform(0, 1, size=(299, 299, 3)).astype(np.uint8) for _ in range(100)] | ||
|
||
def test_encoding(self): | ||
self.encoder = TFInceptionEncoder.load_yaml(self.yaml_path) | ||
ret1 = self.encoder.encode(self.test_data_1) | ||
ret2 = self.encoder.encode(self.test_data_2) | ||
self.assertEqual(ret1.shape[0], 1) | ||
self.assertEqual(ret2.shape[0], 1000) |
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 @@ | ||
!TFInceptionEncoder | ||
parameter: | ||
model_dir: /ext/inception_v4/inception_v4.ckpt | ||
batch_size: 64 | ||
select_layer: PreLogitsFlatten |