<jupyter_start><jupyter_text>mobile net<jupyter_code>import cv2
from google.colab.patches import cv2_imshow
from Models.Encoders.Landmark_Encoder.mobilefacenet import MobileFaceNet
mobilenet = MobileFaceNet([112, 112], 136)

checkpoint = torch.load(MOBILE_FACE_NET_WEIGHTS_PATH)

mobilenet.load_state_dict(checkpoint['state_dict'])
mobilenet = mobilenet.eval()
mobilenet = mobilenet.cuda()
landmark_transform=transforms.Compose([transforms.Resize(112)])<jupyter_output><empty_output><jupyter_text>step by step<jupyter_code>id_images, attr_images, ws = next(iter((train_loader)))
inputs = landmark_transform(attr_images[0])
outputs, _ = mobilenet(inputs.cuda())
landmark = torch.reshape(outputs*112, (3, 68, 2))
landmark[:, 17:, :].shape
for i in [0,1,2]:
  show_img =  np.array(np.transpose(inputs[i].squeeze().detach().numpy(), (1, 2, 0)))
  show_img = (show_img * 255).astype(np.uint8)
  #np.clip(show_img, 0, 255)
  cv2.imwrite("show_img.jpg", show_img)
  img_clone = cv2.imread("show_img.jpg")
  lnds_ = landmark.cpu().detach().numpy()
  for (x, y) in lnds_[i].astype(np.int32):
      cv2.circle(img_clone, (x, y), 1, (0, 255, 0), -1)
  cv2_imshow(img_clone)<jupyter_output><empty_output><jupyter_text>all together<jupyter_code>def get_results():
  id_images, attr_images, ws = next(iter((train_loader)))
  inputs = landmark_transform(attr_images[0])
  outputs, _ = mobilenet(inputs.cuda())
  landmark = torch.reshape(outputs*112, (3, 68, 2))
  for i in [0,1,2]:
    show_img =  np.array(np.transpose(inputs[i].squeeze().detach().numpy(), (1, 2, 0)))
    show_img = (show_img * 255).astype(np.uint8)
    cv2.imwrite("show_img.jpg", show_img)
    img_clone = cv2.imread("show_img.jpg")
    lnds_ = landmark.cpu().detach().numpy()
    for (x, y) in lnds_[i].astype(np.int32):
        cv2.circle(img_clone, (x, y), 1, (0, 255, 0), -1)
    cv2_imshow(img_clone)
get_results()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16614906832298137, 'fraction_numerical': 0.042443064182194616, 'mean_word_length': 5.464882943143813, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '594706', 'license': 'MIT', 'n_tokens_mistral': 847, 'n_tokens_neox': 774, 'n_words': 123, 'path': 'Notebooks/Landmarks plot results.ipynb', 'repo_name': 'YuGong123/ID-disentanglement-Pytorch', 'size': '1932'}