from PIL import Image def expand2square(pil_img, background_color): width, height = pil_img.size if width == height: return pil_img elif width > height: result = Image.new(pil_img.mode, (width, width), background_color) result.paste(pil_img, (0, (width - height) // 2)) return result else: result = Image.new(pil_img.mode, (height, height), background_color) result.paste(pil_img, ((height - width) // 2, 0)) return result CAPTION_QUESTIONS = [ 'Could you please give me a detailed description of the image?', 'Can you provide a thorough description of the this image?', 'Please provide a thorough description of the this image', 'Please provide a thorough description of the this image.', 'Please describe in detail the contents of the image.', 'Please describe in detail the contents of the image', 'Could you give a comprehensive explanation of what can be found within this picture?', 'Could you give me an elaborate explanation of this picture?', 'Could you provide me with a detailed analysis of this photo?', 'Could you please give me a detailed description of the image?', 'Can you provide a thorough description of the this image?', 'Please describe in detail the contents of the image', 'Please describe in detail the contents of the image.', 'Can you give a comprehensive explanation of this photo', 'Please provide an elaborate explanation of this picture.', 'Please provide an elaborate explanation of this picture', 'Could you provide me with a detailed analysis of this photo', ] REGION_QUESTIONS = [ 'Can you provide me with a detailed description of the region in the picture marked by ?', "I'm curious about the region represented by in the picture. Could you describe it in detail?", 'What can you tell me about the region indicated by in the image?', "I'd like to know more about the area in the photo labeled . Can you give me a detailed description?", 'Could you describe the region shown as in the picture in great detail?', 'What details can you give me about the region outlined by in the photo?', 'Please provide me with a comprehensive description of the region marked with in the image.', 'Can you give me a detailed account of the region labeled as in the picture?', "I'm interested in learning more about the region represented by in the photo. Can you describe it in detail?", 'What is the region outlined by in the picture like? Could you give me a detailed description?', 'Can you provide me with a detailed description of the region in the picture marked by , please?', "I'm curious about the region represented by in the picture. Could you describe it in detail, please?", 'What can you tell me about the region indicated by in the image, exactly?', "I'd like to know more about the area in the photo labeled , please. Can you give me a detailed description?", 'Could you describe the region shown as in the picture in great detail, please?', 'What details can you give me about the region outlined by in the photo, please?', 'Please provide me with a comprehensive description of the region marked with in the image, please.', 'Can you give me a detailed account of the region labeled as in the picture, please?', "I'm interested in learning more about the region represented by in the photo. Can you describe it in detail, please?", 'What is the region outlined by in the picture like, please? Could you give me a detailed description?', ] REGION_GROUP_QUESTIONS = [ 'Could you please give me a detailed description of these areas ?', 'Can you provide a thorough description of the regions in this image?', 'Please describe in detail the contents of the boxed areas .', 'Could you give a comprehensive explanation of what can be found within in the picture?', 'Could you give me an elaborate explanation of the regions in this picture?', 'Can you provide a comprehensive description of the areas identified by in this photo?', 'Help me understand the specific locations labeled in this picture in detail, please.', 'What is the detailed information about the areas marked by in this image?', 'Could you provide me with a detailed analysis of the regions designated in this photo?', 'What are the specific features of the areas marked in this picture that you can describe in detail?', 'Could you elaborate on the regions identified by in this image?', 'What can you tell me about the areas labeled in this picture?', 'Can you provide a thorough analysis of the specific locations designated in this photo?', 'I am interested in learning more about the regions marked in this image. Can you provide me with more information?', 'Could you please provide a detailed description of the areas identified by in this photo?', 'What is the significance of the regions labeled in this picture?', 'I would like to know more about the specific locations designated in this image. Can you provide me with more information?', 'Can you provide a detailed breakdown of the regions marked in this photo?', 'What specific features can you tell me about the areas identified by in this picture?', 'Could you please provide a comprehensive explanation of the locations labeled in this image?', 'Can you provide a detailed account of the regions designated in this photo?', 'I am curious about the areas marked in this picture. Can you provide me with a detailed analysis?', 'What important details can you tell me about the specific locations identified by in this image?', 'Could you please provide a detailed description of the regions labeled in this photo?', 'What can you tell me about the features of the areas designated in this picture?', 'Can you provide a comprehensive overview of the regions marked in this image?', 'I would like to know more about the specific locations identified by in this photo. Can you provide me with more information?', 'What is the detailed information you have on the areas labeled in this picture?', 'Could you provide me with a thorough analysis of the regions designated in this image?', 'Can you provide a detailed explanation of the specific locations marked by in this photo?' ] GCG_QUESTIONS = [ 'Could you please give me a detailed description of the image? Please respond with interleaved segmentation masks for the corresponding parts of the answer.', 'Can you provide a thorough description of the this image? Please output with interleaved segmentation masks for the corresponding phrases.', 'Please describe in detail the contents of the image. Please respond with interleaved segmentation masks for the corresponding parts of the answer.', 'Could you give a comprehensive explanation of what can be found within this picture? Please output with interleaved segmentation masks for the corresponding phrases.', 'Could you give me an elaborate explanation of this picture? Please respond with interleaved segmentation masks for the corresponding phrases.', 'Could you provide me with a detailed analysis of this photo? Please output with interleaved segmentation masks for the corresponding parts of the answer.', ] SEG_QUESTIONS = [ "Can you segment the {class_name} in this image?", "Please segment {class_name} in this image.", "What is {class_name} in this image? Please respond with segmentation mask.", "What is {class_name} in this image? Please output segmentation mask.", "Can you segment the {class_name} in this image", "Please segment {class_name} in this image", "What is {class_name} in this image? Please respond with segmentation mask", "What is {class_name} in this image? Please output segmentation mask", "Could you provide a segmentation mask for the {class_name} in this image?", "Please identify and segment the {class_name} in this image.", "Where is the {class_name} in this picture? Please respond with a segmentation mask.", "Can you highlight the {class_name} in this image with a segmentation mask?", "Could you provide a segmentation mask for the {class_name} in this image", "Please identify and segment the {class_name} in this image", "Where is the {class_name} in this picture? Please respond with a segmentation mask", "Can you highlight the {class_name} in this image with a segmentation mask", ] ANSWER_LIST = [ "It is [SEG].", "Sure, [SEG].", "Sure, it is [SEG].", "Sure, the segmentation result is [SEG].", "[SEG].", ]