UNetDynamic

function defined in module FastVision.Models


			UNetDynamic(backbone, inputsize, k_out[; kwargs...])

Create a U-Net model from convolutional backbone architecture. After every downsampling layer (i.e. pooling or strided convolution), a skip connection and an upsampling block are inserted, resulting in a convolutional network with the same spatial output dimensions as its input. Outputs an array with k_out channels.

Keyword arguments

  • fdownscale = 0: Number of upsampling steps to leave out. By default there will be one upsampling step for every downsampling step in backbone. Hence if the input spatial size is (h, w), the output size will be (h/2^fdownscale, w/2^fdownscale), i.e. to get outputs at half the resolution, set fdownscale = 1.

  • kwargs...: Other keyword arguments are passed through to upsample.

Examples


			
			
			
			using
			
			 

	
			FastAI
			,
			
			 
			Metalhead
			

			

			
			backbone
			 
			=
			 
			
			
			
			
			
			Metalhead
			.
			
			ResNet50
			(
			
			pretrain
			=
			true
			)
			.
			
			layers
			[
			1
			]
			[
			
			1
			:
			
			end
			-
			1
			]
			

			
			unet
			 
			=
			 
			
			UNetDynamic
			(
			backbone
			,
			 
			
			(
			256
			,
			 
			256
			,
			 
			3
			,
			 
			1
			)
			
			;
			 
			
			k_out
			 
			=
			 
			10
			)
			

			
			
			

	
			Flux
			.
			

	
			outputsize
			(
			unet
			,
			 
			
			(
			256
			,
			 
			256
			,
			 
			3
			,
			 
			1
			)
			)
			 
			==
			 
			
			(
			256
			,
			 
			256
			,
			 
			10
			,
			 
			1
			)
			

			

			
			unet
			 
			=
			 
			
			UNetDynamic
			(
			backbone
			,
			 
			
			(
			256
			,
			 
			256
			,
			 
			3
			,
			 
			1
			)
			
			;
			 
			
			fdownscalk_out
			 
			=
			 
			10
			)
			

			
			
			

	
			Flux
			.
			

	
			outputsize
			(
			unet
			,
			 
			
			(
			256
			,
			 
			256
			,
			 
			3
			,
			 
			1
			)
			)
			 
			==
			 
			
			(
			256
			,
			 
			256
			,
			 
			10
			,
			 
			1
			)
Methods

There is 1 method for FastVision.Models.UNetDynamic: