PAWS 🐾 Predicting View-Assignments with Support Samples

Related tags

Deep Learning suncet
Overview

PAWS 🐾 Predicting View-Assignments with Support Samples

This repo provides a PyTorch implementation of PAWS (predicting view assignments with support samples), as described in the paper Semi-Supervised Learning of Visual Features by Non-Parametrically Predicting View Assignments with Support Samples.

CD21_260_SWAV2_PAWS_Flowchart_FINAL

PAWS is a method for semi-supervised learning that builds on the principles of self-supervised distance-metric learning. PAWS pre-trains a model to minimize a consistency loss, which ensures that different views of the same unlabeled image are assigned similar pseudo-labels. The pseudo-labels are generated non-parametrically, by comparing the representations of the image views to those of a set of randomly sampled labeled images. The distance between the view representations and labeled representations is used to provide a weighting over class labels, which we interpret as a soft pseudo-label. By non-parametrically incorporating labeled samples in this way, PAWS extends the distance-metric loss used in self-supervised methods such as BYOL and SwAV to the semi-supervised setting.

Also provided in this repo is a PyTorch implementation of the semi-supervised SimCLR+CT method described in the paper Supervision Accelerates Pretraining in Contrastive Semi-Supervised Learning of Visual Representations. SimCLR+CT combines the SimCLR self-supervised loss with the SuNCEt (supervised noise contrastive estimation) loss for semi-supervised learning.

Pretrained models

We provide the full checkpoints for the PAWS pre-trained models, both with and without fine-tuning. The full checkpoints for the pretrained models contain the backbone, projection head, and prediction head weights. The finetuned model checkpoints, on the other hand, only include the backbone and linear classifier head weights. Top-1 classification accuracy for the pretrained models is reported using a nearest neighbour classifier. Top-1 classification accuracy for the finetuned models is reported using the class labels predicted by the network's last linear layer.

1% labels 10% labels
epochs network pretrained (NN) finetuned pretrained (NN) finetuned
300 RN50 65.4% 66.5% 73.1% 75.5%
200 RN50 64.6% 66.1% 71.9% 75.0%
100 RN50 62.6% 63.8% 71.0% 73.9%

Running PAWS semi-supervised pre-training and fine-tuning

Config files

All experiment parameters are specified in config files (as opposed to command-line-arguments). Config files make it easier to keep track of different experiments, as well as launch batches of jobs at a time. See the configs/ directory for example config files.

Requirements

  • Python 3.8
  • PyTorch install 1.7.1
  • torchvision
  • CUDA 11.0
  • Apex with CUDA extension
  • Other dependencies: PyYaml, numpy, opencv, submitit

Labeled Training Splits

For reproducibilty, we have pre-specified the labeled training images as .txt files in the imagenet_subsets/ and cifar10_subsets/ directories. Based on your specifications in your experiment's config file, our implementation will automatically use the images specified in one of these .txt files as the set of labeled images. On ImageNet, if you happen to request a split of the data that is not contained in imagenet_subsets/ (for example, if you set unlabeled_frac !=0.9 and unlabeled_frac != 0.99, i.e., not 10% labeled or 1% labeled settings), then the code will independently flip a coin at the start of training for each training image with probability 1-unlabeled_frac to determine whether or not to keep the image's label.

Single-GPU training

PAWS is very simple to implement and experiment with. Our implementation starts from the main.py, which parses the experiment config file and runs the desired script (e.g., paws pre-training or fine-tuning) locally on a single GPU.

CIFAR10 pre-training

For example, to pre-train with PAWS on CIFAR10 locally, using a single GPU using the pre-training experiment configs specificed inside configs/paws/cifar10_train.yaml, run:

python main.py
  --sel paws_train
  --fname configs/paws/cifar10_train.yaml

CIFAR10 evaluation

To fine-tune the pre-trained model for a few optimization steps with the SuNCEt (supervised noise contrastive estimation) loss on a single GPU using the pre-training experiment configs specificed inside configs/paws/cifar10_snn.yaml, run:

python main.py
  --sel snn_fine_tune
  --fname configs/paws/cifar10_snn.yaml

To then evaluate the nearest-neighbours performance of the model, locally, on a single GPU, run:

python snn_eval.py
  --model-name wide_resnet28w2 --use-pred
  --pretrained $path_to_pretrained_model
  --unlabeled_frac $1.-fraction_of_labeled_train_data_to_support_nearest_neighbour_classification
  --root-path $path_to_root_datasets_directory
  --image-folder $image_directory_inside_root_path
  --dataset-name cifar10_fine_tune
  --split-seed $which_prespecified_seed_to_split_labeled_data

Multi-GPU training

Running PAWS across multiple GPUs on a cluster is also very simple. In the multi-GPU setting, the implementation starts from main_distributed.py, which, in addition to parsing the config file and launching the desired script, also allows for specifying details about distributed training. For distributed training, we use the popular open-source submitit tool and provide examples for a SLURM cluster, but feel free to edit main_distributed.py for your purposes to specify a different approach to launching a multi-GPU job on a cluster.

ImageNet pre-training

For example, to pre-train with PAWS on 64 GPUs using the pre-training experiment configs specificed inside configs/paws/imgnt_train.yaml, run:

python main_distributed.py
  --sel paws_train
  --fname configs/paws/imgnt_train.yaml
  --partition $slurm_partition
  --nodes 8 --tasks-per-node 8
  --time 1000
  --device volta16gb

ImageNet fine-tuning

To fine-tune a pre-trained model on 4 GPUs using the fine-tuning experiment configs specified inside configs/paws/fine_tune.yaml, run:

python main_distributed.py
  --sel fine_tune
  --fname configs/paws/fine_tune.yaml
  --partition $slurm_partition
  --nodes 1 --tasks-per-node 4
  --time 1000
  --device volta16gb

To evaluate the fine-tuned model locally on a single GPU, use the same config file, configs/paws/fine_tune.yaml, but change training: true to training: false. Then run:

python main.py
  --sel fine_tune
  --fname configs/paws/fine_tune.yaml

Soft Nearest Neighbours evaluation

To evaluate the nearest-neighbours performance of a pre-trained ResNet50 model on a single GPU, run:

python snn_eval.py
  --model-name resnet50 --use-pred
  --pretrained $path_to_pretrained_model
  --unlabeled_frac $1.-fraction_of_labeled_train_data_to_support_nearest_neighbour_classification
  --root-path $path_to_root_datasets_directory
  --image-folder $image_directory_inside_root_path
  --dataset-name $one_of:[imagenet_fine_tune, cifar10_fine_tune]

License

See the LICENSE file for details about the license under which this code is made available.

Citation

If you find this repository useful in your research, please consider giving a star and a citation 🐾

@article{assran2021semisupervised,
  title={Semi-Supervised Learning of Visual Features by Non-Parametrically Predicting View Assignments with Support Samples}, 
  author={Assran, Mahmoud, and Caron, Mathilde, and Misra, Ishan, and Bojanowski, Piotr and Joulin, Armand, and Ballas, Nicolas, and Rabbat, Michael},
  journal={arXiv preprint arXiv:2104.13963},
  year={2021}
}
@article{assran2020supervision,
  title={Supervision Accelerates Pretraining in Contrastive Semi-Supervised Learning of Visual Representations},
  author={Assran, Mahmoud, and Ballas, Nicolas, and Castrejon, Lluis, and Rabbat, Michael},
  journal={arXiv preprint arXiv:2006.10803},
  year={2020}
}
Comments
  • How sensitive is PAWS to batch size?

    How sensitive is PAWS to batch size?

    Hi, thanks for sharing the code! I am curious about PAWS' sensitivity to batch size. Have you tried experimenting with smaller batch sizes (such as 256 or 512) that 8 GPUs can afford on ImageNet? Thanks. @MidoAssran

    opened by frank-xwang 12
  • error when loading the optimizer's state dict

    error when loading the optimizer's state dict

    Hi! I'm trying to load the provided checkpoints on paws_train.py, in order to run a few extra pre-training epochs with my custom dataset. For the model, I had to remove "module" from the state_dict keys, but for the optimizer, I get the following error:

    ValueError: loaded state dict contains a parameter group that doesn't match the size of optimizer's group
    

    Apparently, the number of parameters for the optimizer has changed. How to solve this? Currently, I'm simply not loading the optimizer and using a new one created from init_opt.

    Thanks in advance!

    opened by amandalucasp 11
  • High memory usage even with low batch size and support set size

    High memory usage even with low batch size and support set size

    Hi. I am trying to replicate the method on a 4 (24G each) GPU system. According to table 7 of the paper, it is possible to run with the following config on 8 16G GPUs: unsupervised_batch_size=32, classes_per_batch=70, supervised_imgs_per_cls=3, multicrop=6, unique_classes_per_rank=true

    I use the following configuration: unsupervised_batch_size=32, classes_per_batch=35, supervised_imgs_per_cls=3, multicrop=6, unique_classes_per_rank=true

    This setting occupies nearly 24GB on each of the 4 gpus. Is there any reason why I see such a high memory usage despite using lower configuration?

    opened by klnavaneet 10
  • Unable to reproduce the 1% and 10% NN results

    Unable to reproduce the 1% and 10% NN results

    Hi,

    I am interested in using the pretrained models, but I could not reproduce the numbers in the table. I downloaded the 1% checkpoints and ran the soft nearest neighbor evaluation on 1% ImageNet for all 3 checkpoints (100, 200, and 300 epochs). Here are the numbers that I got:

    paws

    Here's the command that I used:

    for epoch in {100,200,300}
    do
        python snn_eval.py \
            --model-name resnet50 \
            --use-pred \
            --pretrained weights/paws_imgnt_1percent_${epoch}ep.pth.tar \
            --unlabeled-frac 0.99 \
            --root-path /nfs/ada/hpirsiav/datasets \
            --image-folder imagenet \
            --dataset-name imagenet_fine_tune
    done &> output/paws_imgnt_1percent_100_200_300_epochs
    

    Here's the output of the above command:

    + for epoch in '{100,200,300}'
    + python snn_eval.py --model-name resnet50 --use-pred --pretrained weights/paws_imgnt_1percent_100ep.pth.tar --unlabeled-frac 0.99 --root-path /nfs/ada/hpirsiav/datasets --image-folder imagenet --dataset-name imagenet_fine_tune
    INFO:root:loaded pretrained model with msg: <All keys matched successfully>
    INFO:root:loaded pretrained encoder from epoch: 100 path: weights/paws_imgnt_1percent_100ep.pth.tar
    INFO:root:making imagenet data transforms
    INFO:root:keep file: imagenet_subsets/99percent.txt
    INFO:root:data-path /nfs/ada/hpirsiav/datasets/imagenet/train/
    INFO:root:Initialized ImageNet
    INFO:root:ImageNet fine-tune dataset created
    INFO:root:Using imagenet_subsets/99percent.txt
    Namespace(dataset_name='imagenet_fine_tune', device='cuda:0', image_folder='imagenet', model_name='resnet50', normalize=True, pretrained='weights/paws_imgnt_1percent_100ep.pth.tar', root_path='/nfs/ada/hpirsiav/datasets', split_seed=152, subset_path='imagenet_subsets/', unlabeled_frac=0.99, use_pred=True)
    weights/paws_imgnt_1percent_100ep.pth.tar
    INFO:root:[0/801]
    INFO:root:[50/801]
    INFO:root:[100/801]
    INFO:root:[150/801]
    INFO:root:[200/801]
    INFO:root:[250/801]
    INFO:root:[300/801]
    INFO:root:[350/801]
    INFO:root:[400/801]
    INFO:root:[450/801]
    INFO:root:[500/801]
    INFO:root:[550/801]
    INFO:root:[600/801]
    INFO:root:[650/801]
    INFO:root:[700/801]
    INFO:root:[750/801]
    INFO:root:[800/801]
    INFO:root:torch.Size([12811, 2048])
    INFO:root:torch.Size([12811])
    INFO:root:making imagenet data transforms
    INFO:root:keep file: imagenet_subsets/0percent.txt
    INFO:root:data-path /nfs/ada/hpirsiav/datasets/imagenet/val/
    INFO:root:Initialized ImageNet
    INFO:root:ImageNet fine-tune dataset created
    INFO:root:flipping coin to keep labels
    INFO:root:torch.Size([12811, 2048])
    INFO:root:torch.Size([12811, 1000])
    INFO:root:3125
    INFO:root:[    0/3125] 56.250% 68.750%
    INFO:root:[   50/3125] 60.172% 80.637%
    INFO:root:[  100/3125] 61.510% 81.869%
    INFO:root:[  150/3125] 61.714% 81.995%
    INFO:root:[  200/3125] 61.318% 81.654%
    INFO:root:[  250/3125] 61.479% 81.150%
    INFO:root:[  300/3125] 61.047% 81.001%
    INFO:root:[  350/3125] 61.556% 81.214%
    INFO:root:[  400/3125] 61.300% 80.923%
    INFO:root:[  450/3125] 61.183% 80.807%
    INFO:root:[  500/3125] 61.190% 80.913%
    INFO:root:[  550/3125] 60.923% 80.944%
    INFO:root:[  600/3125] 61.023% 80.886%
    INFO:root:[  650/3125] 61.089% 80.856%
    INFO:root:[  700/3125] 61.198% 80.947%
    INFO:root:[  750/3125] 61.293% 80.992%
    INFO:root:[  800/3125] 61.236% 81.000%
    INFO:root:[  850/3125] 61.259% 80.986%
    INFO:root:Initialized ImageNet
    INFO:root:ImageNet fine-tune dataset created
    INFO:root:Using imagenet_subsets/99percent.txt
    Namespace(dataset_name='imagenet_fine_tune', device='cuda:0', image_folder='imagenet', model_name='resnet50', normalize=True, pretrained='weights/paws_imgnt_1percent_200ep.pth.tar', root_path='/nfs/ada/hpirsiav/datasets', split_seed=152, subset_path='imagenet_subsets/', unlabeled_frac=0.99, use_pred=True)
    weights/paws_imgnt_1percent_200ep.pth.tar
    INFO:root:[0/801]
    INFO:root:[50/801]
    INFO:root:[100/801]
    INFO:root:[150/801]
    INFO:root:[200/801]
    INFO:root:[250/801]
    INFO:root:[300/801]
    INFO:root:[350/801]
    INFO:root:[400/801]
    INFO:root:[450/801]
    INFO:root:[500/801]
    INFO:root:[550/801]
    INFO:root:[600/801]
    INFO:root:[650/801]
    INFO:root:[700/801]
    INFO:root:[750/801]
    INFO:root:[800/801]
    INFO:root:torch.Size([12811, 2048])
    INFO:root:torch.Size([12811])
    INFO:root:making imagenet data transforms
    INFO:root:keep file: imagenet_subsets/0percent.txt
    INFO:root:data-path /nfs/ada/hpirsiav/datasets/imagenet/val/
    INFO:root:Initialized ImageNet
    INFO:root:ImageNet fine-tune dataset created
    INFO:root:flipping coin to keep labels
    INFO:root:torch.Size([12811, 2048])
    INFO:root:torch.Size([12811, 1000])
    INFO:root:3125
    INFO:root:[    0/3125] 56.250% 68.750%
    INFO:root:[   50/3125] 62.868% 81.740%
    INFO:root:[  100/3125] 63.057% 81.869%
    INFO:root:[  150/3125] 63.411% 82.036%
    INFO:root:[  200/3125] 62.935% 81.779%
    INFO:root:[  250/3125] 62.998% 81.673%
    INFO:root:[  300/3125] 62.708% 81.499%
    INFO:root:[  350/312
    INFO:root:[ 3050/3125] 63.123% 81.828%
    INFO:root:[ 3100/3125] 63.137% 81.822%
    INFO:root:top1/top5: 63.18/81.824
    + for epoch in '{100,200,300}'
    + python snn_eval.py --model-name resnet50 --use-pred --pretrained weights/paws_imgnt_1percent_300ep.pth.tar --unlabeled-frac 0.99 --root-path /nfs/ada/hpirsiav/datasets --image-folder imagenet --dataset-name imagenet_fine_tune
    INFO:root:loaded pretrained model with msg: <All keys matched successfully>
    INFO:root:loaded pretrained encoder from epoch: 300 path: weights/paws_imgnt_1percent_300ep.pth.tar
    INFO:root:making imagenet data transforms
    INFO:root:keep file: imagenet_subsets/99percent.txt
    INFO:root:data-path /nfs/ada/hpirsiav/datasets/imagenet/train/
    INFO:root:Initialized ImageNet
    INFO:root:ImageNet fine-tune dataset created
    INFO:root:Using imagenet_subsets/99percent.txt
    Namespace(dataset_name='imagenet_fine_tune', device='cuda:0', image_folder='imagenet', model_name='resnet50', normalize=True, pretrained='weights/paws_imgnt_1percent_300ep.pth.tar', root_path='/nfs/ada/hpirsiav/datasets', split_seed=152, subset_path='imagenet_subsets/', unlabeled_frac=0.99, use_pred=True)
    weights/paws_imgnt_1percent_300ep.pth.tar
    INFO:root:[0/801]
    INFO:root:[50/801]
    INFO:root:[100/801]
    INFO:root:[150/801]
    INFO:root:[200/801]
    INFO:root:[250/801]
    INFO:root:[300/801]
    INFO:root:[350/801]
    INFO:root:[400/801]
    INFO:root:[450/801]
    INFO:root:[500/801]
    INFO:root:[550/801]
    INFO:root:[600/801]
    INFO:root:[650/801]
    INFO:root:[700/801]
    INFO:root:[750/801]
    INFO:root:[800/801]
    INFO:root:torch.Size([12811, 2048])
    INFO:root:torch.Size([12811])
    INFO:root:making imagenet data transforms
    INFO:root:keep file: imagenet_subsets/0percent.txt
    INFO:root:data-path /nfs/ada/hpirsiav/datasets/imagenet/val/
    INFO:root:Initialized ImageNet
    INFO:root:ImageNet fine-tune dataset created
    INFO:root:flip
    INFO:root:[ 1200/3125] 64.207% 82.176%
    INFO:root:[ 1250/3125] 64.194% 82.124%
    INFO:root:[ 1300/3125] 64.109% 82.052%
    INFO:root:[ 1350/3125] 64.175% 82.078%
    INFO:root:[ 1400/3125] 64.115% 82.026%
    INFO:root:[ 1450/3125] 64.085% 82.021%
    INFO:root:[ 1500/3125] 64.028% 82.037%
    INFO:root:[ 1550/3125] 64.148% 82.068%
    INFO:root:[ 1600/3125] 64.030% 82.062%
    INFO:root:[ 1650/3125] 64.067% 82.102%
    INFO:root:[ 1700/3125] 64.084% 82.110%
    INFO:root:[ 1750/3125] 63.996% 82.050%
    INFO:root:[ 1800/3125] 64.027% 82.069%
    INFO:root:[ 1850/3125] 63.979% 82.060%
    INFO:root:[ 1900/3125] 63.966% 82.032%
    INFO:root:[ 1950/3125] 63.922% 82.019%
    INFO:root:[ 2000/3125] 63.996% 82.031%
    INFO:root:[ 2050/3125] 63.923% 82.039%
    INFO:root:[ 2100/3125] 63.922% 82.023%
    INFO:root:[ 2150/3125] 63.950% 82.046%
    INFO:root:[ 2200/3125] 63.994% 82.076%
    INFO:root:[ 2250/3125] 64.066% 82.119%
    INFO:root:[ 2300/3125] 64.108% 82.144%
    INFO:root:[ 2350/3125] 64.114% 82.167%
    INFO:root:[ 2400/3125] 64.122% 82.171%
    INFO:root:[ 2450/3125] 64.099% 82.168%
    INFO:root:[ 2500/3125] 64.132% 82.165%
    INFO:root:[ 2550/3125] 64.122% 82.137%
    INFO:root:[ 2600/3125] 64.132% 82.122%
    INFO:root:[ 2650/3125] 64.146% 82.144%
    INFO:root:[ 2700/3125] 64.192% 82.169%
    INFO:root:[ 2750/3125] 64.181% 82.218%
    INFO:root:[ 2800/3125] 64.174% 82.205%
    INFO:root:[ 2850/3125] 64.170% 82.190%
    INFO:root:[ 2900/3125] 64.193% 82.211%
    INFO:root:[ 2950/3125] 64.131% 82.212%
    INFO:root:[ 3000/3125] 64.097% 82.183%
    INFO:root:[ 3050/3125] 64.114% 82.180%
    INFO:root:[ 3100/3125] 64.133% 82.165%
    INFO:root:top1/top5: 64.15/82.164
    

    Thank You Ajinkya Tejankar

    opened by ajtejankar 7
  • "training" parameter missing from "meta" section of config file cifar10_snn.yaml

    Hi! I was trying to finetune a pretrained model for cifar10 subsets. Regarding this, I have got 2 questions:

    1. In the file "src/fine_tune.py", we are importing "training" parameter from "meta" section of args (line no. 65). But this parameter is missing from the config file "configs/paws/cifar10_snn.yaml". Am I referring to the wrong config file here?
    2. Why have we kept training=True while creating validation dataset of cifar10 (line no. 154 in src/fine_tune.py)?

    Thanks!

    opened by priyamdey 5
  • What

    What "class_per_batch" should I set to reproduce the ImageNet 10% label performance

    Hi, thank you for sharing the code.

    I'm a bit confused by the class_per_batch option here.

    In Sec 5. of the paper, it said "randomly sample 6720 images, 960 classes and 7 images per class", but in the config it showed 15 classes and 7 images per class. I wonder if I need to change this 15?

    In the code it showed num_support = supervised_views * s_batch_size * classes_per_batch, so the num_support we actually have is 105 = 1 * 7 * 15 on each gpu

    I know 960 is 15 x 64, does it mean that the actuall num_support should be classes_per_batch * u_batch_size ?

    I ran the main.py on single device with 4 gpu, but the trained performance is extremely low (less than 10% accuracy) , I'm not sure if it is related to this problem.

    opened by Ir1d 5
  • Installation issue (apex)

    Installation issue (apex)

    Hi @MidoAssran, others who were successfully able to install this repo

    Thanks for the great code. I am having issues installing apex with cuda extension. Here is my python, pytorch, torchvision and torch.cuda versions:

    Python : 3.8.11 torch : '1.7.1' torchvision : '0.8.2' torch.version.cuda : '11.0'

    I think the initial error was due to cuda version mismatch between apex and pytorch as mentioned here So I followed the instructions in the above link but still not able to install it. I think my python, pytorch and cuda version matches with the requirements specified in this repo. a) Could you please let me know how did you install apex? b) Which cuda version was used to install apex?

    Thanks in Advance.

    opened by dmlpt 4
  • [Question] Using h as the target vector

    [Question] Using h as the target vector

    Dear all,

    I had a question about the code.

    https://github.com/facebookresearch/suncet/blob/731547d727b8c94d06c08a7848b4955de3a70cea/src/paws_train.py#L313

    In this line, the authors get the target views and target supports from the h vector, but they get anchor views and anchor supports from the z vector few lines above.

    I believe that h is the vector that is before the pred head, and z is the vector after pred head, but in the paper, it seems like z for anchor and z for positive view (target) has to come from the same layer.

    Can anyone explain why the code is written in this way?

    Thank you~!

    opened by chaddy1004 3
  • running fine tuning on a custom dataset

    running fine tuning on a custom dataset

    Hello, congratulations on your work and thanks for sharing your code. I'm currently trying to run fine-tuning using a single GPU and a custom dataset (around 3k samples), but I keep getting CUDA out of memory error. Is there any parameter I can adjust for the code to require less memory?

    Thanks!

    opened by amandalucasp 3
  • Question for ClassStratifiedSampler

    Question for ClassStratifiedSampler

    Thank you for the code.

    I am trying to reproduce the results and found some strange things in the code. I ran main.py with cifar10_train.yaml. As demonstrated, I thought that ClassStratifiedSamplershould produce [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... ], I believe that it makes us use label_matrix for convenience. However, when I checked the actual labels (sdata[-1] on line 280 of paws_train.py), the labels were just sampled in a stratified manner, but were not in the appropriate order. For example, [1, 8, 7, 9, 5, 2, 6, 0, 4, 3] is repeated. sdata[-1] and labels on paws_train.py do not match.... Nevertheless, the model is trained properly. Did I miss something? Thank you in advance.

    • I am using pytorch 1.9.0
    opened by min9kwak 3
  • why the label are all some when training?

    why the label are all some when training?

    the idea in your paper is amazing,great truths are all simple. I have the following questions: 1、why the labels of each Iteration are same(support images are sampled with ClassStratifiedSampler meaning every sampling the same class and have the same class order?)https://github.com/facebookresearch/suncet/blob/731547d727b8c94d06c08a7848b4955de3a70cea/src/paws_train.py#L167 2、The size of the mutil-cropp image is 96 x 96, and the FC layer exists on the network. Why can the loss of the mutil-cropp image be propagated backward? 3、Have you considered label loss plus unlable loss as the final loss during training? In this way, finetune is not required.

    opened by happyxuwork 3
  • adjusting code to fit a multi-label problem

    adjusting code to fit a multi-label problem

    Hi! Thanks for sharing your work :)

    I am trying to perform some tests using paws on a multi-label problem. Major changes I've have already implemented: (1) my dataset custom class and its corresponding "Trans" class as the "TransImageNet"; (2) implemented custom _make_data_transforms functions and _make_multicrop_data_transforms.

    Now I'm working on adapting the ClassStratifiedSampler, and therefore also labels_matrix. I'm having trouble fully understanding how these two work together: is labels_matrix simply concatenating one-hot labels from the sampler (ClassStratifiedSampler) and smoothing it? Also, do you think it make sense to adapt ClassStratifiedSampler to a multi-label dataset, or should I just use a regular sampler (then I could do as mentioned in https://github.com/facebookresearch/suncet/issues/22#issuecomment-901921422)?

    Thanks in advance for any tip!

    opened by amandalucasp 7
  • using ViT backbone with PAWS

    using ViT backbone with PAWS

    Hi Mido,

    Thanks for the excellent work and thanks for sharing. I was curious if you have tried using a ViT backbone to test PAWS with a transformer backbone. I was wondering cause your concurrent work (DiNO) and others use ViT so I was hoping you have done that. If not, do you reckon it will be straight forward to do that by adjusting the model in your code or you foresee bigger implications?

    Cheers

    opened by islam-nassar 1
  • Using pretrained networks and small amounts of labelled data

    Using pretrained networks and small amounts of labelled data

    Firstly, great and interesting work on PAWS! I have been working on using PAWS for my specific uses and I had a couple questions. Have you ever used a pretrained model as the backbone and used PAWS for further training? Particularly what I'm trying to do is use a backbone trained on imagenet, and then use PAWS to tune the weights on a smaller dataset with very few labels per class. I was wondering if you've ever experimented with a training setup like this, and what you would recommend hyperparameter-wise.

    My second question touches on the 'very few labels per class' I just mentioned. In the ablation study in the paper you go down to 4 labels per class. Have you experimented with anything lower? I've been working on training PAWS with one labeled image per class, and was wondering what insights you had on training in this case. I know you have mentioned that increasing the number of classes per support batch is important, but I was wondering if there was anything else.

    Thanks so much!

    opened by brocksar 5
  • [Question] PAWS code for TPU

    [Question] PAWS code for TPU

    Hi!, I know the code is made in order to use Multi GPU or Single GPU. But maybe it has been discussed to extend it for TPU? (And use free capabilities like Google Colab).

    Thanks!

    opened by jmarrietar 0
Owner
Facebook Research
Facebook Research
🐾 Semantic segmentation of paws from cute pet images (PyTorch)

?? paw-segmentation ?? Semantic segmentation of paws from cute pet images ?? Semantic segmentation of paws from cute pet images (PyTorch) ?? Paw Segme

Zabir Al Nazi Nabil 3 Feb 1, 2022
Blender add-on: Add to Cameras menu: View → Camera, View → Add Camera, Camera → View, Previous Camera, Next Camera

Blender add-on: Camera additions In 3D view, it adds these actions to the View|Cameras menu: View → Camera : set the current camera to the 3D view Vie

German Bauer 11 Feb 8, 2022
(CVPR 2022 - oral) Multi-View Depth Estimation by Fusing Single-View Depth Probability with Multi-View Geometry

Multi-View Depth Estimation by Fusing Single-View Depth Probability with Multi-View Geometry Official implementation of the paper Multi-View Depth Est

Bae, Gwangbin 138 Dec 28, 2022
[CVPR'21] Projecting Your View Attentively: Monocular Road Scene Layout Estimation via Cross-view Transformation

Projecting Your View Attentively: Monocular Road Scene Layout Estimation via Cross-view Transformation Weixiang Yang, Qi Li, Wenxi Liu, Yuanlong Yu, Y

null 118 Dec 26, 2022
PanopticBEV - Bird's-Eye-View Panoptic Segmentation Using Monocular Frontal View Images

Bird's-Eye-View Panoptic Segmentation Using Monocular Frontal View Images This r

null 63 Dec 16, 2022
Multiple types of NN model optimization environments. It is possible to directly access the host PC GUI and the camera to verify the operation. Intel iHD GPU (iGPU) support. NVIDIA GPU (dGPU) support.

mtomo Multiple types of NN model optimization environments. It is possible to directly access the host PC GUI and the camera to verify the operation.

Katsuya Hyodo 24 Mar 2, 2022
This repository contains the code used for Predicting Patient Outcomes with Graph Representation Learning (https://arxiv.org/abs/2101.03940).

Predicting Patient Outcomes with Graph Representation Learning This repository contains the code used for Predicting Patient Outcomes with Graph Repre

Emma Rocheteau 76 Dec 22, 2022
SkipGNN: Predicting Molecular Interactions with Skip-Graph Networks (Scientific Reports)

SkipGNN: Predicting Molecular Interactions with Skip-Graph Networks Molecular interaction networks are powerful resources for the discovery. While dee

Kexin Huang 49 Oct 15, 2022
Predicting Semantic Map Representations from Images with Pyramid Occupancy Networks

This is the code associated with the paper Predicting Semantic Map Representations from Images with Pyramid Occupancy Networks, published at CVPR 2020.

Thomas Roddick 219 Dec 20, 2022
We are More than Our JOints: Predicting How 3D Bodies Move

We are More than Our JOints: Predicting How 3D Bodies Move Citation This repo contains the official implementation of our paper MOJO: @inproceedings{Z

null 72 Oct 20, 2022
A DNN inference latency prediction toolkit for accurately modeling and predicting the latency on diverse edge devices.

Note: This is an alpha (preview) version which is still under refining. nn-Meter is a novel and efficient system to accurately predict the inference l

Microsoft 244 Jan 6, 2023
A geometric deep learning pipeline for predicting protein interface contacts.

A geometric deep learning pipeline for predicting protein interface contacts.

null 44 Dec 30, 2022
An end-to-end regression problem of predicting the price of properties in Bangalore.

Bangalore-House-Price-Prediction An end-to-end regression problem of predicting the price of properties in Bangalore. Deployed in Heroku using Flask.

Shruti Balan 1 Nov 25, 2022
Implementation of Enformer, Deepmind's attention network for predicting gene expression, in Pytorch

Enformer - Pytorch (wip) Implementation of Enformer, Deepmind's attention network for predicting gene expression, in Pytorch. The original tensorflow

Phil Wang 235 Dec 27, 2022
Predicting path with preference based on user demonstration using Maximum Entropy Deep Inverse Reinforcement Learning in a continuous environment

Preference-Planning-Deep-IRL Introduction Check my portfolio post Dependencies Gym stable-baselines3 PyTorch Usage Take Demonstration python3 record.

Tianyu Li 9 Oct 26, 2022
Predicting lncRNA–protein interactions based on graph autoencoders and collaborative training

Predicting lncRNA–protein interactions based on graph autoencoders and collaborative training Code for our paper "Predicting lncRNA–protein interactio

zhanglabNKU 1 Nov 29, 2022
Predicting Tweet Sentiment Maching Learning and streamlit

Predicting-Tweet-Sentiment-Maching-Learning-and-streamlit (I prefere using Visual Studio Code ) Open the folder in VS Code Run the first cell in requi

null 1 Nov 20, 2021
Predicting Student Attentiveness using OpenCV

Predicting-Student-Attentiveness-using-OpenCV The model will predict if a student is attentive or not through facial parameter received through the st

Johann Pinto 2 Aug 20, 2022
Python KNN model: Predicting a probability of getting a work visa. Tableau: Non-immigrant visas over the years.

The value of international students to the United States. Probability of getting a non-immigrant visa. Project timeline: Jan 2021 - April 2021 Project

Zinaida Dvoskina 2 Nov 21, 2021