UI-Venus
UI-Venus copied to clipboard
Sinlge Image for demo testing
I want to do a single-image demo inference, and I do not want to set this parameter, is it viable? --screenspot_test "ScreenSpot-v2-variants" \
@kasteric Thanks for your question! You can do a single-image inference with the following codes for UI_Venus_Ground_7B:
import cv2
from models.grounding.ui_venus_ground_7b import UI_Venus_Ground_7B
model = UI_Venus_Ground_7B()
model.load_model(model_name_or_path='path_to_UI_Venus_Ground_7B/')
image_path = './assets/performance_venus.png'
instruction='Grounding Benchmark'
res = model.inference(instruction, image_path)
img = cv2.imread(image_path)
h, w, _ = img.shape
point = [int(res['point'][0] * w),int(res['point'][1] * h)]
cv2.circle(img, point, 10, (0, 0, 255), -1)
cv2.imwrite('./test_res.png', img)