LLaVA / infer_LLaVa.py
YuqianFu's picture
Upload folder using huggingface_hub
9794be0 verified
from llava.eval.run_llava import eval_model
from llava.mm_utils import tokenizer_image_token, process_images, get_model_name_from_path
import os
model_path = "liuhaotian/llava-v1.5-7b"
#prompt = "What are the things I should be cautious about when I visit here?"
#prompt = "Could you help describe the input image?"
prompt="Could you help describe the main object of the input image?"
#prompt="In this view, identify and describe the object that is most likely for human interaction"
#prompt = "Please describe the object with the green mask in the input image."
# prompt = "Please describe the object coverd by the green mask."
# prompt = "what is the object covered by the green mask?"
#prompt = "what is the object in the red bounding box of the image"
#prompt = "What is the object that is most likely interative with people?"
#image_file = "https://llava-vl.github.io/static/images/view.jpg"
image_file_list = ["images/WechatIMG2241.jpg","images/WechatIMG2242.jpg", "images/WechatIMG2243.jpg", "images/WechatIMG2244.jpg"]
ego_list = os.listdir("./images/ego")
ego_list = ["images/ego/"+ f for f in ego_list]
exo_list = os.listdir("./images/exo")
exo_list = ["images/exo/"+f for f in exo_list]
images = ego_list
print(ego_list)
args = type('Args', (), {
"model_path": model_path,
"model_base": None,
"model_name": get_model_name_from_path(model_path),
"query": prompt,
"conv_mode": None,
"image_file": images,
"sep": ",",
"temperature": 0,
"top_p": None,
"num_beams": 1,
"max_new_tokens": 512
})()
eval_model(args)