Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Ammmob/PixelSmile
/ functions
Functions
63 in github.com/Ammmob/PixelSmile
⨍
Functions
63
◇
Types & classes
4
↓ 4 callers
Function
extract_clip_image_features
Extract normalized CLIP image features from [-1, 1] tensors.
pixelsmile/train.py:130
↓ 4 callers
Method
get_arcface_embeddings
Get ArcFace embeddings for a batch of images, assuming single person per image. Args: images: Batch of images (B
pixelsmile/losses/identity.py:381
↓ 4 callers
Function
resize
( image: Image.Image, target_size: tuple, resize_mode: str, box:list = None )
pixelsmile/utils/image.py:105
↓ 4 callers
Function
vae_decode
(latents)
pixelsmile/train.py:695
↓ 3 callers
Function
compute_text_embeddings
( method: str, pipeline: QwenImageEditPlusPipeline, data: dict, image: Image, max_sequence
pixelsmile/linear_conditioning.py:5
↓ 3 callers
Function
encode_vae
(img)
pixelsmile/precompute.py:114
↓ 2 callers
Function
_center_and_normalize_points_torch
(points)
pixelsmile/losses/identity.py:84
↓ 2 callers
Function
_pad_prompt_batch
(emb_list, mask_list)
pixelsmile/data/dataset.py:53
↓ 2 callers
Function
align_face
img: (H,W,C) - full image landmark: shape(5,2) - facial landmarks in full image
pixelsmile/losses/identity.py:120
↓ 2 callers
Method
compute_id_loss
Compute identity loss (1 - cosine similarity) for single person per image.
pixelsmile/losses/identity.py:437
↓ 2 callers
Function
compute_single_branch
(model_pred, target_latents)
pixelsmile/train.py:193
↓ 1 callers
Function
_compute_direct
( pipeline: QwenImageEditPlusPipeline, data: dict, image: Image, max_sequence_length:int, )
pixelsmile/linear_conditioning.py:28
↓ 1 callers
Function
_compute_score_one
( pipeline: QwenImageEditPlusPipeline, data: dict, image: Image, max_sequence_length: int = 10
pixelsmile/linear_conditioning.py:71
↓ 1 callers
Function
_compute_score_one_all
( pipeline: QwenImageEditPlusPipeline, data: dict, image: Image, max_sequence_length: int = 10
pixelsmile/linear_conditioning.py:200
↓ 1 callers
Function
_compute_score_one_exp
( pipeline: QwenImageEditPlusPipeline, data: dict, image: Image, max_sequence_length: int = 10
pixelsmile/linear_conditioning.py:115
↓ 1 callers
Function
_compute_score_one_tgt
( pipeline: QwenImageEditPlusPipeline, data: dict, image: Image, max_sequence_length: int = 10
pixelsmile/linear_conditioning.py:159
↓ 1 callers
Function
_compute_score_scale
( pipeline: QwenImageEditPlusPipeline, data: dict, image: Image, max_sequence_length: int = 10
pixelsmile/linear_conditioning.py:45
↓ 1 callers
Method
_init_negative_pool
Load all npy embeddings from REF_CLUSTER_CENTER, and store them in a num_tensor, 512 tensors
pixelsmile/losses/identity.py:357
↓ 1 callers
Function
build_clip_image_encoder
Build frozen CLIP image encoder (no text encoder) Returns ------- vision_model : torch.nn.Module processor : CLIPImageProcessor
pixelsmile/train.py:90
↓ 1 callers
Function
build_edit_condition
(subject: str, expression: str, scale: float)
pixelsmile/infer.py:92
↓ 1 callers
Function
calc_id_loss
(id_loss_fn, pairs)
pixelsmile/train.py:164
↓ 1 callers
Function
calc_target_loss
Compute fully symmetric base reconstruction loss (Symmetric Base Reconstruction Loss).
pixelsmile/train.py:182
↓ 1 callers
Function
clean_cache
(cache_dir)
pixelsmile/train.py:80
↓ 1 callers
Method
compute_id_loss_two_images
Compute identity loss between two batches of images. Args: images1: Batch of images (B, C, H, W) images2: Bat
pixelsmile/losses/identity.py:492
↓ 1 callers
Function
detect_face_pose
Determine if a face is front-facing or side-facing based on landmarks. Args: landmarks: 5-point facial landmarks [left_eye, righ
pixelsmile/losses/identity.py:305
↓ 1 callers
Function
estimate_affine_torch
(src, dst)
pixelsmile/losses/identity.py:29
↓ 1 callers
Function
estimate_norm_torch
PyTorch version of estimate_norm function Args: lmk (torch.Tensor): 5 facial landmarks of shape (5, 2) image_size (int):
pixelsmile/losses/identity.py:159
↓ 1 callers
Function
fn_recursive_add_processors
(name: str, module: torch.nn.Module, processors)
pixelsmile/utils/lora_utils.py:7
↓ 1 callers
Function
get_sigmas
(timesteps, n_dim=4, dtype=torch.float32)
pixelsmile/train.py:488
↓ 1 callers
Function
get_subject_name
(data_type: str)
pixelsmile/infer.py:84
↓ 1 callers
Function
load_input_image
(image_path: str)
pixelsmile/infer.py:101
↓ 1 callers
Function
load_pipe
(model_path: str, lora_path: str, device: torch.device)
pixelsmile/infer.py:68
↓ 1 callers
Function
lora_processors
Extract LoRA processors from model
pixelsmile/utils/lora_utils.py:3
↓ 1 callers
Function
main
(args)
pixelsmile/train.py:208
↓ 1 callers
Function
main
()
pixelsmile/infer.py:129
↓ 1 callers
Function
parse_args
()
pixelsmile/train.py:85
↓ 1 callers
Function
parse_args
()
pixelsmile/infer.py:39
↓ 1 callers
Function
pre_compute_embeddings
Pre-compute text embeddings and image latents, then save them to disk. Supports resume-from-breakpoint and multi-GPU parallel computation.
pixelsmile/precompute.py:14
↓ 1 callers
Function
resize_with_crop
Crop after resize, optionally biasing around a face box.
pixelsmile/utils/image.py:55
↓ 1 callers
Function
resize_with_padding
Resize image with aspect ratio preserved, then pad to target size. Args: image (PIL.Image) target_size (tuple): (width, heig
pixelsmile/utils/image.py:17
↓ 1 callers
Function
run_edit
(pipe, image, expression: str, scale: float, subject: str, seed: int)
pixelsmile/infer.py:106
↓ 1 callers
Function
scale_fun
(x: float)
pixelsmile/utils/image.py:120
↓ 1 callers
Function
scale_scores
(data)
pixelsmile/utils/image.py:132
↓ 1 callers
Function
set_global_seed
Set random seed for python / numpy / torch (CPU & CUDA). Each process uses seed + RANK to avoid identical randomness across GPUs.
pixelsmile/train.py:60
↓ 1 callers
Function
single_face_preserving_resize
Resize image while ensuring a single face is preserved in the output. Args: img: PIL Image face_bbox: Single [x1, y1, x2
pixelsmile/losses/identity.py:628
Method
__call__
(self, image)
pixelsmile/losses/identity.py:216
Method
__call__
Compute the ID loss and regional diffusion loss. Args: decoded_images: Decoded images from the model
pixelsmile/losses/identity.py:601
Method
__getitem__
(self, idx)
pixelsmile/data/dataset.py:33
Method
__init__
( self, dataset_path: str, cache_dir: str, max_samples: Optional[int] = None,
pixelsmile/data/dataset.py:9
Method
__init__
(self, det_model_path)
pixelsmile/losses/identity.py:212
Method
__init__
(self, device='cuda', use_state_negative_pool=False, det_model_path=None, rec_model_path=None)
pixelsmile/losses/identity.py:340
Method
__init__
( self, mode: str = "hinge", symmetric: bool = True, margin: float = 0.2,
pixelsmile/losses/contrast.py:8
Method
__len__
(self)
pixelsmile/data/dataset.py:30
Method
_triplet_hinge
Hinge triplet: max(0, d(G,P) - d(G,N) + margin).
pixelsmile/losses/contrast.py:69
Method
_triplet_nce
InfoNCE-style triplet on positive vs. negative logits.
pixelsmile/losses/contrast.py:93
Method
_triplet_ratio
Log-ratio triplet: log((d(G,P)+eps)/(d(G,N)+eps)).
pixelsmile/losses/contrast.py:81
Function
calculate_dimensions
Calculate dimensions that fit the target area while maintaining aspect ratio
pixelsmile/utils/image.py:6
Function
collate_fn
(examples)
pixelsmile/data/dataset.py:82
Method
compute_id_loss_with_embeddings
Compute identity loss directly from embeddings.
pixelsmile/losses/identity.py:466
Method
forward
Compute contrastive loss for one or two branches.
pixelsmile/losses/contrast.py:36
Method
get_arcface_embeddings_with_features
Get ArcFace embeddings and hidden features for single face.
pixelsmile/losses/identity.py:528
Method
hook_fn
(module, input, output)
pixelsmile/losses/identity.py:574
Function
norm_crop_torch
PyTorch version of norm_crop function using torch.nn.functional.grid_sample Args: img (torch.Tensor): Input image tensor of shap
pixelsmile/losses/identity.py:226