Skip to content

Commit

Permalink
ImageToTensor
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Nov 6, 2024
1 parent 2ed52f7 commit 0c9cde3
Showing 1 changed file with 63 additions and 6 deletions.
69 changes: 63 additions & 6 deletions python/GafferMLUI/ImageToTensorUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,76 @@

GafferML.ImageToTensor,

# "description",
# """
# Converts Gaffer data to tensors for use with the Inference node.
# Potential data sources include PrimitiveVariableQuery nodes to fetch data
# from 3D scenes, or expressions to generate arbitrary input data.
# """,
"description",
"""
Converts images to tensors for use with the Inference node.
> Note : Only the data window is converted, as it would typically be
> wasteful to convert and process the empty pixels outside the data window.
> If this is necessary, merge the image over a Constant image before
> conversion.
""",

plugs = {

"image" : [

"description",
"""
The image to be converted.
""",

],

"view" : [

"description",
"""
The image view to take the tensor data from.
""",

"plugValueWidget:type", "GafferImageUI.ViewPlugValueWidget",

"noduleLayout:visible", False,

],

"channels" : [

"description",
"""
The list of channels to convert. Channels are added to the
tensor in the order specified, so can be shuffled by changing
the order. For example, an order of `[ "B", "G", "R" ]` might
be needed for use with model trained on images using OpenCV
conventions.
""",

"noduleLayout:visible", False,

],

"interleaveChannels" : [

"description",
"""
Interleaves the channel data, so that all channels for a single
pixel are adjacent in memory.
""",

"noduleLayout:visible", False,

],

"tensor" : [

"description",
"""
The output tensor.
""",

"layout:visibilityActivator", lambda plug : False,

],

}
Expand Down

0 comments on commit 0c9cde3

Please sign in to comment.