February 2018
Intermediate to advanced
262 pages
6h 59m
English
Here, we combine all the logic that we have seen individually for the algorithms in the chapter:
### For ResNettrn_labels = []trn_resnet_features = []for d,la in train_loader: o = my_resnet(Variable(d.cuda())) o = o.view(o.size(0),-1) trn_labels.extend(la) trn_resnet_features.extend(o.cpu().data)val_labels = []val_resnet_features = []for d,la in val_loader: o = my_resnet(Variable(d.cuda())) o = o.view(o.size(0),-1) val_labels.extend(la) val_resnet_features.extend(o.cpu().data)### For Inceptiontrn_inception_features = LayerActivations(my_inception.Mixed_7c)for da,la in train_loader: _ = my_inception(Variable(da.cuda()))trn_inception_features.remove()val_inception_features = LayerActivations(my_inception.Mixed_7c) ...
Read now
Unlock full access