turicreate.style_transfer.StyleTransfer.stylize — Turi Create API 6.4.1 documentation (original) (raw)

StyleTransfer. stylize(images, style=None, verbose=True, max_size=800, batch_size=4)

Stylize an SFrame of Images given a style index or a list of styles.

Parameters: images : SFrame | SArray turicreate.Image A dataset that has the same content image column that was used during training. style : None int list The selected style or list of styles to use on the images. IfNone, all styles will be applied to each image in images. verbose : bool, optional If True, print progress updates. max_size : int or tuple Max input image size that will not get resized during stylization. Images with a side larger than this value, will be scaled down, due to time and memory constraints. If tuple, interpreted as (max width, max height). Without resizing, larger input images take more time to stylize. Resizing can effect the quality of the final stylized image. batch_size : int, optional If you are getting memory errors, try decreasing this value. If you have a powerful computer, increasing this value may improve performance.
Returns: out : SFrame or SArray or turicreate.Image If style is a list, an SFrame is always returned. If styleis a single integer, the output type will match the input type (Image, SArray, or SFrame).

Examples

image = tc.Image("/path/to/image.jpg") stylized_images = model.stylize(image, style=[0, 1]) Data: +--------+-------+------------------------+ | row_id | style | stylized_image | +--------+-------+------------------------+ | 0 | 0 | Height: 256 Width: 256 | | 0 | 1 | Height: 256 Width: 256 | +--------+-------+------------------------+ [2 rows x 3 columns]

images = tc.image_analysis.load_images('/path/to/images') stylized_images = model.stylize(images) Data: +--------+-------+------------------------+ | row_id | style | stylized_image | +--------+-------+------------------------+ | 0 | 0 | Height: 256 Width: 256 | | 0 | 1 | Height: 256 Width: 256 | | 0 | 2 | Height: 256 Width: 256 | | 0 | 3 | Height: 256 Width: 256 | | 1 | 0 | Height: 640 Width: 648 | | 1 | 1 | Height: 640 Width: 648 | | 1 | 2 | Height: 640 Width: 648 | | 1 | 3 | Height: 640 Width: 648 | +--------+-------+------------------------+ [8 rows x 3 columns]