axinc-ai / ailia-models-cpp

C++ version of ailia models repository
17 stars 2 forks source link

Implement CLIP #26

Closed kyakuno closed 1 year ago

kyakuno commented 1 year ago

24

kyakuno commented 1 year ago

Python

[[49406   320  2751 49407     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0]
 [49406   320  1929 49407     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0]
 [49406   320  2368 49407     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0     0     0     0     0     0     0     0
      0     0     0     0     0]]
 INFO clip.py (169) : Embedding 0 to 3
 INFO clip.py (196) : chelsea.png
libpng warning: iCCP: known incorrect sRGB profile
 INFO clip.py (203) : Start inference...
==============================================================
class_count=3
+ idx=0
  category=2[a cat ]
  prob=0.9848435521125793
+ idx=1
  category=1[a dog ]
  prob=0.01479444932192564
+ idx=2
  category=0[a human ]
  prob=0.00036194053245708346
 INFO clip.py (226) : Script finished successfully.
kyakuno commented 1 year ago

PythonのPreprocess

Input chelsea

Output temp

kyakuno commented 1 year ago

C++

kyakuno@KazukinoMacBook-Pro clip % ./clip     
env_id : 0 type : 0 name : CPU
env_id : 1 type : 1 name : CPU-AppleAccelerate
env_id : 2 type : 2 name : MPSDNN-Apple M1 Max
you can select environment using -e option
env_name: MPSDNN-Apple M1 Max
Input Text : a dog
Tokens : 49406 320 1929 49407 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
Input Text : a cat
Tokens : 49406 320 2368 49407 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
Input Text : a human
Tokens : 49406 320 2751 49407 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
Text embedding
Image embedding
libpng warning: iCCP: known incorrect sRGB profile
input 451x300 output 300x300 ratio 2.013393x1.339286
features 512
input_img 150528 150528
a dog 0.013109
a cat 0.985716
a human 0.001175
Program finished successfully.