Notes and supplementary code for a tutorial in few-shot learning
Code: https://github.com/LEGO999/A-tutorial-for-few-shot-learning
Prof. Shusen Wang at the Stevens Institute of Technology provided an informative tutorial for few-shot learning and metric learning. I took lecture notes and complemented this tutorial with additional materials and code built on PyTorch.
Definition of few-shot learning
Few-shot l...
Do adversarial defenses improve the robustness of DNNs?
Code: https://github.com/LEGO999/AD_robustness
Deep Neural Networks (DNNs) are known to be prone to adversarial attacks. Adversarial attacks manipulate predictions of DNNs via adding crafted perturbations, as shown in Fig.1.
Fig.1 An adversarial example generated by FGSM (source: Goodfellow et al., 2014)
In essence, adversarial attacks opt...
(PyTorch) Pitfalls in KL Divergence
Kullback-Leibler divergence (KL divergence) is a preferable alternative for cross-entropy with soft labels as the reason is explained in the previous post. The mathematical form of KL divergence is demonstrated in following equations:
\(D_{KL} = \sum \mathbf{g}(x) \log\frac{\mathbf{g}(x)}{\mathbf{f}(x)}\)
, where $\mathbf{f}(x)$ is predicted pro...
(PyTorch) 10X Speed up! Stack as an Alternative for Concat
Shape Difference
Both torch.cat() and torch.stack() will concatenate a sequence of tensors. torch.cat() will concatenate tensors along a given dimension rather than a new dimension.
import torch
concat_tensor = torch.cat([torch.rand(2,3) for _ in range(2)], dim=0)
print(f'The shape of concatenated tensor is {concat_tensor.shape}')
stack_tenso...
(PyTorch) Tensor(CPU, CUDA) and Numpy Array Interoperability
PyTorch tensors could be either CPU or GPU (CUDA). Numpy arrays are always in the memory (CPU).
Pure CPU
Numpy array and CPU tensor
When a CPU tensor is built based on a Numpy tensor, the system will create a new copy in the memory. They won’t have influence on each other.
import torch
import torch.nn as nn
import numpy as np
# c...
(TensorBoard) Non-refreshing TensorBoard
After the operations like writer.add_scalar(), please don’t forget to use writer.flush() to write the buffer to the file.
Common Shell Commands Cheatsheet
Beginning of the .sh files
#!/bin/sh
# Must be put at the beginning of the .sh file
Create directory
mkdir $dir_name
If the directory existed, commands in the following steps will be stopped and warning will be sent.
Create directory with parents directories
mkdir -p $dir_name
If the directory existe...
Takeaways of 3D Deep Learning Tutorial Keynote
Task of 3D Deep Learning
classification
segmentation
reconstruction
Representation
Form
rasterized form (regular)
geometric form (irregular)
Types
multi-view
volumetric
part assembly
point cloud
mesh
implicit (e.g. function space, occupancy network)
Datasets
ShapeNet
PartNet
SceneNet
ScanNet
KITTI
Clas...
18 post articles, 3 pages.