Lesson3 Camvid
colabdev_nbsmachine-learninggpudeep-learningnotebooksPythonfastaipytorchcourse
Export
Image segmentation with CamVid
[ ]
[ ]
[ ]
(#4) [Path('/home/sgugger/.fastai/data/camvid/codes.txt'),Path('/home/sgugger/.fastai/data/camvid/labels'),Path('/home/sgugger/.fastai/data/camvid/valid.txt'),Path('/home/sgugger/.fastai/data/camvid/images')] [ ]
Data
[ ]
(#3) [Path('/home/sgugger/.fastai/data/camvid/images/Seq05VD_f02130.png'),Path('/home/sgugger/.fastai/data/camvid/images/0016E5_05310.png'),Path('/home/sgugger/.fastai/data/camvid/images/0016E5_07230.png')] [ ]
(#3) [Path('/home/sgugger/.fastai/data/camvid/labels/Seq05VD_f03780_P.png'),Path('/home/sgugger/.fastai/data/camvid/labels/0016E5_00840_P.png'),Path('/home/sgugger/.fastai/data/camvid/labels/0016E5_07997_P.png')] [ ]
<matplotlib.axes._subplots.AxesSubplot at 0x7fbc11508950>
[ ]
[ ]
<matplotlib.axes._subplots.AxesSubplot at 0x7fbc1143bf10>
[ ]
(array([960]), tensor([[ 4, 4, 4, ..., 21, 21, 21], , [ 4, 4, 4, ..., 21, 21, 21], , [ 4, 4, 4, ..., 21, 21, 21], , ..., , [19, 19, 19, ..., 17, 17, 17], , [30, 19, 19, ..., 17, 17, 17], , [30, 30, 30, ..., 17, 17, 17]], dtype=torch.uint8))
[ ]
array(['Animal', 'Archway', 'Bicyclist', 'Bridge', 'Building', 'Car', , 'CartLuggagePram', 'Child', 'Column_Pole', 'Fence', 'LaneMkgsDriv', , 'LaneMkgsNonDriv', 'Misc_Text', 'MotorcycleScooter', 'OtherMoving', , 'ParkingBlock', 'Pedestrian', 'Road', 'RoadShoulder', 'Sidewalk', , 'SignSymbol', 'Sky', 'SUVPickupTruck', 'TrafficCone', , 'TrafficLight', 'Train', 'Tree', 'Truck_Bus', 'Tunnel', , 'VegetationMisc', 'Void', 'Wall'], dtype='<U17')
Datasets
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
<matplotlib.axes._subplots.AxesSubplot at 0x7fbc113dbe90>
[ ]
[ ]
[ ]
(torch.Size([8, 3, 360, 480]), torch.Size([8, 360, 480]))
[ ]
Model
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
DynamicUnet( , (layers): ModuleList( , (0): Sequential( , (0): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False) , (1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU(inplace=True) , (3): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False) , (4): Sequential( , (0): BasicBlock( , (conv1): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (1): BasicBlock( , (conv1): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (2): BasicBlock( , (conv1): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , (5): Sequential( , (0): BasicBlock( , (conv1): Conv2d(64, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (downsample): Sequential( , (0): Conv2d(64, 128, kernel_size=(1, 1), stride=(2, 2), bias=False) , (1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , (1): BasicBlock( , (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (2): BasicBlock( , (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (3): BasicBlock( , (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , (6): Sequential( , (0): BasicBlock( , (conv1): Conv2d(128, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (downsample): Sequential( , (0): Conv2d(128, 256, kernel_size=(1, 1), stride=(2, 2), bias=False) , (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , (1): BasicBlock( , (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (2): BasicBlock( , (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (3): BasicBlock( , (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (4): BasicBlock( , (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (5): BasicBlock( , (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , (7): Sequential( , (0): BasicBlock( , (conv1): Conv2d(256, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (downsample): Sequential( , (0): Conv2d(256, 512, kernel_size=(1, 1), stride=(2, 2), bias=False) , (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , (1): BasicBlock( , (conv1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , (2): BasicBlock( , (conv1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (relu): ReLU(inplace=True) , (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , ) , (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , (3): Sequential( , (0): ConvLayer( , (0): Conv2d(512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (1): ConvLayer( , (0): Conv2d(1024, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , ) , (4): UnetBlock( , (shuf): PixelShuffle_ICNR( , (0): ConvLayer( , (0): Conv2d(512, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False) , (1): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (1): PixelShuffle(upscale_factor=2) , ) , (bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (conv1): ConvLayer( , (0): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (conv2): ConvLayer( , (0): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (relu): ReLU() , ) , (5): UnetBlock( , (shuf): PixelShuffle_ICNR( , (0): ConvLayer( , (0): Conv2d(512, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False) , (1): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (1): PixelShuffle(upscale_factor=2) , ) , (bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (conv1): ConvLayer( , (0): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (conv2): ConvLayer( , (0): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (relu): ReLU() , ) , (6): UnetBlock( , (shuf): PixelShuffle_ICNR( , (0): ConvLayer( , (0): Conv2d(384, 768, kernel_size=(1, 1), stride=(1, 1), bias=False) , (1): BatchNorm2d(768, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (1): PixelShuffle(upscale_factor=2) , ) , (bn): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (conv1): ConvLayer( , (0): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (conv2): ConvLayer( , (0): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (relu): ReLU() , ) , (7): UnetBlock( , (shuf): PixelShuffle_ICNR( , (0): ConvLayer( , (0): Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1), bias=False) , (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (1): PixelShuffle(upscale_factor=2) , ) , (bn): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (conv1): ConvLayer( , (0): Conv2d(192, 96, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (conv2): ConvLayer( , (0): Conv2d(96, 96, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (relu): ReLU() , ) , (8): PixelShuffle_ICNR( , (0): ConvLayer( , (0): Conv2d(96, 384, kernel_size=(1, 1), stride=(1, 1), bias=False) , (1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (1): PixelShuffle(upscale_factor=2) , ) , (9): ResizeToOrig() , (10): MergeLayer() , (11): ResBlock( , (convpath): Sequential( , (0): ConvLayer( , (0): Conv2d(99, 99, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(99, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , (2): ReLU() , ) , (1): ConvLayer( , (0): Conv2d(99, 99, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) , (1): BatchNorm2d(99, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) , (idpath): Sequential() , (act): ReLU(inplace=True) , ) , (12): ConvLayer( , (0): Conv2d(99, 32, kernel_size=(1, 1), stride=(1, 1), bias=False) , (1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) , ) , ) ,)
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
Go big
You may have to restart your kernel and come back to this stage if you run out of memory, and may also need to decrease bs.
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
fin
[ ]