def test_export(self): # TODO(xxx): add support for tflite. # FLAGS.tflite_path = os.path.join(self.tempdir, 'test.tflite') FLAGS.saved_model_dir = os.path.join(self.tempdir, 'savedmodel') inspector.main(None) self.assertTrue( tf.saved_model.contains_saved_model(FLAGS.saved_model_dir))
def test_export(self): FLAGS.tflite_path = os.path.join(self.tempdir, 'test.tflite') FLAGS.saved_model_dir = os.path.join(self.tempdir, 'savedmodel') inspector.main(None) self.assertTrue( tf.saved_model.contains_saved_model(FLAGS.saved_model_dir)) self.assertTrue(tf.io.gfile.exists(FLAGS.tflite_path))
def test_infer(self): test_image = np.random.randint(0, 244, (640, 720, 3)).astype(np.uint8) FLAGS.input_image = os.path.join(self.tempdir, 'img.jpg') Image.fromarray(test_image).save(FLAGS.input_image) FLAGS.output_image_dir = self.tempdir inspector.main(None) self.assertTrue(tf.io.gfile.exists(os.path.join(self.tempdir, '0.jpg')))
def test_benchmark(self): inspector.main(None) self.assertFalse( tf.io.gfile.exists(os.path.join(self.tempdir, '0.jpg')))
def test_dry(self): FLAGS.export_ckpt = os.path.join(self.tempdir, 'model') inspector.main(None) self.assertIsNot(tf.train.get_checkpoint_state(self.tempdir), None)