Beispiel #1
0
 def test_should_not_fail_to_blur_background(self, temp_dir: Path):
     output_image_path = temp_dir / 'output.jpg'
     main([
         'blur-background',
         '--source=%s' % EXAMPLE_IMAGE_URL,
         '--output=%s' % output_image_path
     ])
Beispiel #2
0
 def test_should_not_fail_to_draw_mask(self, temp_dir: Path):
     output_image_path = temp_dir / 'mask.jpg'
     main([
         'draw-mask',
         '--source=%s' % EXAMPLE_IMAGE_URL,
         '--output=%s' % output_image_path
     ])
Beispiel #3
0
 def test_should_not_fail_to_draw_selected_mask(self, temp_dir: Path):
     output_image_path = temp_dir / 'mask.jpg'
     main([
         'draw-mask',
         '--source=%s' % EXAMPLE_IMAGE_URL,
         '--output=%s' % output_image_path,
         '--parts', 'left_face', 'right_face'
     ])
Beispiel #4
0
 def test_should_list_all_default_model_urls(self, capsys):
     expected_urls = [
         value
         for key, value in BodyPixModelPaths.__dict__.items()
         if not key.startswith('_')
     ]
     main(['list-models'])
     captured = capsys.readouterr()
     output_urls = captured.out.splitlines()
     LOGGER.debug('output_urls: %s', output_urls)
     missing_urls = set(expected_urls) - set(output_urls)
     assert not missing_urls
Beispiel #5
0
 def test_should_be_able_to_convert_to_tflite_and_use_model(self, temp_dir: Path):
     output_model_file = temp_dir / 'model.tflite'
     main([
         'convert-to-tflite',
         '--model-path=%s' % BodyPixModelPaths.MOBILENET_FLOAT_75_STRIDE_16,
         '--optimize',
         '--quantization-type=int8',
         '--output-model-file=%s' % output_model_file
     ])
     output_image_path = temp_dir / 'mask.jpg'
     main([
         'draw-mask',
         '--model-path=%s' % output_model_file,
         '--model-architecture=%s' % ModelArchitectureNames.MOBILENET_V1,
         '--output-stride=16',
         '--source=%s' % EXAMPLE_IMAGE_URL,
         '--output=%s' % output_image_path
     ])
Beispiel #6
0
import logging
from tf_bodypix.cli import main


if __name__ == '__main__':
    logging.basicConfig(level='INFO')
    main()