MCPcopy Create free account

hub / github.com/RyanWangZf/MedCLIP / functions

Functions110 in github.com/RyanWangZf/MedCLIP

↓ 8 callersMethodfrom_pretrained
If input_dir is None, download pretrained weight from google cloud and load.
medclip/modeling_medclip.py:151
↓ 7 callersMethod__init__
(self, vision_cls=MedCLIPVisionModel, checkpoint=None, vision_checkpoint=None,
medclip/modeling_medclip.py:130
↓ 6 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.)
medclip/vision_model.py:15
↓ 5 callersMethod__init__
(self)
medclip/dataset.py:150
↓ 3 callersMethod_soft_clip_loss
take labels of images and sentences as a softlabel e.g., image_label = [1, 0, 1, -1], sentence_label = [0, 0, 1, -1] this pair has sim
medclip/losses.py:67
↓ 3 callersMethodflops
(self)
medclip/vision_model.py:396
↓ 2 callersMethod_build_prompt_sentence
(self, n = 200)
medclip/dataset.py:307
↓ 2 callersMethod_save_ckpt
(self, model, save_dir)
medclip/trainer.py:231
↓ 2 callersMethod_soft_xent_loss
(self, input, target)
medclip/losses.py:82
↓ 2 callersMethodcompute_logits
(self, img_emb, text_emb)
medclip/modeling_medclip.py:228
↓ 2 callersMethodcontrastive_loss
(self, logits: torch.Tensor)
medclip/modeling_medclip.py:239
↓ 2 callersMethodcreate_sent_segments
do preprocessing to split raw reports into sentence segments for sentence-image contrastive pretraining.
medclip/dataset.py:250
↓ 2 callersMethodencode_text
(self, input_ids=None, attention_mask=None)
medclip/modeling_medclip.py:188
↓ 2 callersFunctionwindow_partition
Args: x: (B, H, W, C) window_size (int): window size Returns: windows: (num_windows*B, window_size, window_size, C)
medclip/vision_model.py:33
↓ 1 callersMethod__init__
(self, model, loss_fn=None, )
medclip/losses.py:91
↓ 1 callersMethod_get_scheduler
Returns the correct learning rate scheduler. Available scheduler: constantlr, warmupconstant, warmuplinear, warmupcosine, warmupcosinewithhar
medclip/trainer.py:213
↓ 1 callersMethod_pad_img
pad img to square.
medclip/dataset.py:221
↓ 1 callersMethod_pad_img
pad img to square.
medclip/dataset.py:406
↓ 1 callersMethod_pad_img
pad img to square.
medclip/dataset.py:495
↓ 1 callersMethod_pad_img
pad img to square.
medclip/dataset.py:574
↓ 1 callersMethod_preprocess_sentence_label
(self)
medclip/dataset.py:294
↓ 1 callersMethodclip_loss
(self, similarity: torch.Tensor)
medclip/modeling_medclip.py:234
↓ 1 callersMethodencode_image
(self, pixel_values=None)
medclip/modeling_medclip.py:196
↓ 1 callersMethodevaluate
(self, eval_dataloader=None)
medclip/evaluator.py:32
↓ 1 callersMethodforward_features
(self, x)
medclip/vision_model.py:568
↓ 1 callersFunctiongenerate_chexpert_class_prompts
Generate text prompts for each CheXpert classification task Parameters ---------- n: int number of prompts per class Returns
medclip/prompts.py:35
↓ 1 callersMethodload_from_medclip
handle key mismatch of medclip and the vision encoder.
medclip/modeling_medclip.py:63
↓ 1 callersMethodload_from_medclip
handle key mismatch of medclip and the vision encoder.
medclip/modeling_medclip.py:105
↓ 1 callersMethodpad_img
pad img to square.
medclip/dataset.py:134
↓ 1 callersFunctionprocess_class_prompts
(cls_prompts)
medclip/prompts.py:108
↓ 1 callersFunctionprocess_class_prompts_for_tuning
(cls_prompts, n_context, class_specific_context)
medclip/prompts.py:118
↓ 1 callersMethodsample_sent_prompts
(self, row)
medclip/dataset.py:230
↓ 1 callersMethodtrain
output_path: model save path checkpoint_path: model load and continue to learn path
medclip/trainer.py:26
↓ 1 callersFunctionwindow_reverse
Args: windows: (num_windows*B, window_size, window_size, C) window_size (int): Window size H (int): Height of image
medclip/vision_model.py:47
Method__call__
Main method to prepare for the model one or several image(s). <Tip warning={true}> NumPy arrays and PyTorch tensors are con
medclip/dataset.py:46
Method__call__
(self, batch)
medclip/dataset.py:337
Method__call__
(self, batch)
medclip/dataset.py:434
Method__call__
(self, batch)
medclip/dataset.py:512
Method__call__
(self, batch)
medclip/dataset.py:602
Method__getitem__
(self, index)
medclip/dataset.py:192
Method__getitem__
(self, index)
medclip/dataset.py:398
Method__getitem__
(self, index)
medclip/dataset.py:487
Method__getitem__
(self, index)
medclip/dataset.py:566
Method__init__
(self, dim, window_size, num_heads, qkv_bias=True, qk_scale=None, attn_drop=0., proj_drop=0.)
medclip/vision_model.py:76
Method__init__
(self, dim, input_resolution, num_heads, window_size=7, shift_size=0, mlp_ratio=4., qkv_bias=
medclip/vision_model.py:178
Method__init__
(self, input_resolution, dim, norm_layer=nn.LayerNorm)
medclip/vision_model.py:294
Method__init__
(self, dim, input_resolution, depth, num_heads, window_size, mlp_ratio=4., qkv_bias=True, qk_
medclip/vision_model.py:354
Method__init__
(self, img_size=256, patch_size=4, in_chans=1, embed_dim=128, norm_layer=None)
medclip/vision_model.py:415
Method__init__
(self, img_size=256, patch_size=4, in_chans=1, proj_dim=512, embed_dim=128, depths=[2, 2, 6,
medclip/vision_model.py:476
Method__init__
specify class_names if doing zero-shot classification. mode: `binary`, 'multiclass`, or `multilabel`, if set None, the method will aut
medclip/evaluator.py:18
Method__init__
(self, do_resize=True, size=224, resample=Image.BICUBIC, do_center_crop=Tr
medclip/dataset.py:31
Method__init__
support data list in mimic-cxr-train, chexpert-train
medclip/dataset.py:158
Method__init__
Args: use_EDA: easy data augmentation from textaugment
medclip/dataset.py:321
Method__init__
support data list in mimic-5x200, chexpert-5x200, rsna-balanced-test, covid-test args: imgtransform: a torchvision transform
medclip/dataset.py:366
Method__init__
(self, mode, cls_prompts=None, n_prompt=5)
medclip/dataset.py:419
Method__init__
support data list in mimic-5x200, mimic-5x200-finetune, chexpert-5x200, chexpert-5x200-finetune, rsna-balanced-test, rsna-balanced-train, covi
medclip/dataset.py:455
Method__init__
(self, mode)
medclip/dataset.py:508
Method__init__
support data list in mimic-5x200, mimic-5x200-finetune, chexpert-5x200, chexpert-5x200-finetune, rsna-balanced-test, rsna-balanced-train, covi
medclip/dataset.py:533
Method__init__
(self, mode, cls_prompts=None, n_prompt=5, n_context=16, class_specific_context=False)
medclip/dataset.py:588
Method__init__
(self, bert_type=constants.BERT_TYPE, proj_dim = 512, proj_bias = False)
medclip/modeling_medclip.py:16
Method__init__
(self, checkpoint=None, medclip_checkpoint=None)
medclip/modeling_medclip.py:49
Method__init__
args: checkpoint: load from the vision encoder checkpoint medclip_checkpoint: load from the vision-text dual encoders checkpoint
medclip/modeling_medclip.py:87
Method__init__
(self, medclip_model, ensemble=False, **kwargs)
medclip/modeling_medclip.py:245
Method__init__
args: vision_model: the medclip vision model that encodes input images into embeddings. num_class: number of classes to predict
medclip/modeling_medclip.py:285
Method__init__
(self, fixed_weights, num_to_learn)
medclip/modeling_medclip.py:336
Method__init__
(self, medclip_model, n_context, class_specific_context, num_class, mode, ensemble=True, join
medclip/modeling_medclip.py:363
Method__init__
(self, model)
medclip/losses.py:8
Method__init__
(self, args=None)
medclip/trainer.py:23
Method__len__
(self)
medclip/dataset.py:218
Method__len__
(self)
medclip/dataset.py:415
Method__len__
(self)
medclip/dataset.py:504
Method__len__
(self)
medclip/dataset.py:583
Method_init_weights
(self, m)
medclip/vision_model.py:551
Method_soft_bce_loss
(self, input, target)
medclip/losses.py:86
Method_split_report_into_segment
clean up raw reports into sentences
medclip/dataset.py:257
Methodextra_repr
(self)
medclip/vision_model.py:143
Methodextra_repr
(self)
medclip/vision_model.py:267
Methodextra_repr
(self)
medclip/vision_model.py:325
Methodextra_repr
(self)
medclip/vision_model.py:393
Methodflops
(self, N)
medclip/vision_model.py:146
Methodflops
(self)
medclip/vision_model.py:271
Methodflops
(self)
medclip/vision_model.py:328
Methodflops
(self)
medclip/vision_model.py:444
Methodflops
(self)
medclip/vision_model.py:602
Methodforward
(self, x)
medclip/vision_model.py:24
Methodforward
Args: x: input features with shape of (num_windows*B, N, C) mask: (0/-inf) mask with shape of (num_windows, Wh*Ww, Wh
medclip/vision_model.py:110
Methodforward
(self, x)
medclip/vision_model.py:229
Methodforward
x: B, H*W, C
medclip/vision_model.py:302
Methodforward
(self, x)
medclip/vision_model.py:382
Methodforward
(self, x)
medclip/vision_model.py:434
Methodforward
(self, x)
medclip/vision_model.py:597
Methodforward
(self, input_ids, attention_mask)
medclip/modeling_medclip.py:28
Methodforward
args: pixel_values: tensor with shape [bs, 3, img_size, img_size]
medclip/modeling_medclip.py:76
Methodforward
args: pixel_values: tensor with shape [bs, 3, img_size, img_size]
medclip/modeling_medclip.py:118
Methodforward
(self, input_ids=None, pixel_values=None, attention_mask=None, return_loss=Non
medclip/modeling_medclip.py:202
Methodforward
take image pixel values (after transform) and prompt_inputs (a dict of {'class1':{'input_ids':...,'attention_mask':,...}), 'class2':...}
medclip/modeling_medclip.py:250
Methodforward
(self, pixel_values, labels=None, return_loss=True, **kwargs, )
medclip/modeling_medclip.py:313
Methodforward
(self, inp)
medclip/modeling_medclip.py:348
Methodforward
take image pixel values (after transform) and prompt_inputs (a dict of {'class1':{'input_ids':...,'attention_mask':,...}), 'class2':...}
medclip/modeling_medclip.py:400
Methodforward
args: labels: the image corresponds to which classes of diagnoses text_labels: the text corresponds to which classes of diagnoses
medclip/losses.py:11
next →1–100 of 110, ranked by callers