Let's think step by step.

STEP 1. Identify the objects from the original prompt, and assign each object a key in the form of #1, #2, etc.
If some object appears multiple times in the prompt, assign a different key each time it appears.
For instance, in the case of "three X", each 'X' should be assigned different keys.
The closer the object is to the front, the higher its number should be.

Examples for STEP 1:
Example 1.
- original prompt: "a realistic photo of a pigeon and two cats with bat wings flying over a crocodile made of glass in the volcanic area"
- The original prompt has four objects - one instance of "a pigeon", two instances of "a cat with bat wings", and one instance of "a crocodile made of glass"
- object #1: "a crocodile made of glass"
- object #2: "a pigeon"
- object #3: "a cat with bat wings"
- object #4: "a cat with bat wings"

Example 2.
- original prompt: "a rainbow colored cat and a dog with spider legs"
- The original prompt has two objects.
- object #1: "a rainbow colored cat"
- object #2: "a dog with spider legs"

STEP 2. Generate a base prompt, which each object is substituted by its key.
If an object appears multiple times, list each occurrence and separate them with "and".
For instance, if there are "three X" and each 'X' has keys '#2', '#3', and '#4', it should be written as '#2 and #3 and #4'.
The base prompt should contain exact details which the original prompt has.

Examples for STEP 2:
Example 1.
- original prompt: "a realistic photo of a pigeon and two cats with bat wings flying over a crocodile made of glass in the volcanic area"
- base prompt: "a realistic photo of #2, #3 and #4 flying over #1 in the volcanic area"

Example 2.
- original prompt: "a rainbow colored cat and a dog with spider legs"
- base prompt: "#1 and #2"

Example 3.
- original prompt: "a glowing rat swimming in the pool, comic style:
- base prompt: "#1 swimming in the pool, comic style"

STEP 3. For each object, generate a prompt that can be used to generate that specific object.
The object prompt should have exactly one placeholder of form '#N', which is the key of the target object.

Examples for STEP 3:
Example 1.
- original prompt: "a glowing rat swimming in the pool, comic style:
- base prompt: "a realistic photo of #2, #3 and #4 flying over #1 in the volcanic area"
- the prompt for object "#1" is: "a realistic photo of #1 in the volcanic area".
- the prompt for object "#2" is: "a realistic photo of #2 flying over the volcanic area".
- the prompt for object "#3" is: "a realistic photo of #3 flying over the volcanic area".
- the prompt for object "#4" is: "a realistic photo of #4 flying over the volcanic area".

STEP 4. Generate a bounding box (bbox) for each object.
The bounding box is a list of four numbers denoting
    [top-left x coordinate, top-left y coordinate, botom-right x coordinate, bottom-right y coordinate]
Each number is a real value between 0 and 1.
The top-left coordinate of the image is (0, 0), and the bottom-right coordinate is (1, 1).
The bounding box should not go beyond the boundaries of the image.
Generate a bounding box considering the relationships between objects. The overall image should be balanced and centered.
Determine the width and height of the bounding box considering the shape of the object.
If two objects can be seperated, their bounding boxes should not overlap. Make a gap between their bounding boxes.
Also, try avoid too small (width or height less than 0.2), too narrow, or too wide bounding boxes.

Examples for STEP 4:
- original prompt: "a glowing rat swimming in the pool, comic style:
- base prompt: "a realistic photo of #2, #3 and #4 flying over #1 in the volcanic area"
- the bbox for object "#1": [0.5, 0.75, 0.4, 0.3]
- the bbox for object "#2": [0.8, 0.35, 0.2, 0.2]
- the bbox for object "#3": [0.2, 0.3, 0.2, 0.2]
- the bbox for object "#4": [0.55, 0.3, 0.2, 0.2]

STEP 5. Identify rare concepts from each object, and find relevant frequent concepts.
The program often struggles to accurately generate images when the input text contains rare concepts that are not commonly found in reality.
To address this, when a rare concept is identified in the input text, you should replace it with relevant yet more frequent concepts.
The replaced frequent concepts may include parent concepts and umbrella terms.
This will help the text-to-image generation program produce better-aligned images.

You can perform the following process step by step: 
    a. Identify and extract any rare concepts from the provided input text.
    b. Replace the extracted rare concept with a more frequent concept.
    Specifically, split the rare concept into the main noun subject and the context,
    and replace the main noun subject with a more frequent noun subject that is likely to appear in the context of the original rare concept.
    Ensure that the replaced frequent noun subject retains the properties of the original main noun subject as much as possible while being appropriate to the context of the rare concept.
    If necessary, you may use multiple frequent concepts step by step to narrow down from the general to the specific. For example, object -> animal -> crocodile.
    Try to keep the number of frequent concepts small. Usually, one frequent concept is enough.
    c. Generate a text sequence that starts from the text with replaced frequent concepts and ends with the text with the original rare concepts.
    If there are multiple frequent concepts, order them from general to specific.

Examples for STEP 5:
Example 1.
- object: "a crocodile made of glass"
- a crocodile made of glass does not exist in reality.
- main noun subject: crocodile; context: made of glass; replaced frequent subject: object, animal
- frequent concepts: ["an object made of glass", "an animal made of glass"]
Example 2.
- object: "a pigeon"
- You don't need to find any frequent concepts.
- frequent concepts: []
Example 3.
- object: "a cat with bat wings"
- a cat with bat wings does not exist in reality, while an animal with bat wing does.
- main noun subject: cat; context: with bat wings; replaced frequent subject: animal
- frequent concepts: ["an animal with bat wings"]
Example 4.
- object: "a hairy hamburger"
- a hairy hamburger does not exist in reality, while a hairy object does.
- main noun subject: hamburger; context: hairy; replaced frequent subject: object
- frequent concepts: ["a hairy object"]
Example 5.
- object: "a peach made of glass"
- a peach made of glass does not exist in reality, while the possibility of a pink sphere made of glass existing is much higher.
- main noun subject: peach; context: made of glass; replaced frequent subject: pink sphere
- frequent concepts: ["a pink sphere made of glass"]
Example 6.
- object: "a horned frog"
- a horned frog does not exist in reality, while a horned animal does.
- main noun subject: frog; context: horned; replaced frequent subject: animal
- frequent concepts: ["a horned animal"]
Example 7.
- object: "a swimming helicopter"
- a swimming helicopter does not exist in reality, while the possibility of a swimming vehicle existing is much higher.
- main noun subject: helicopter; context: swimming; replaced frequent subject: vehicle
- frequent concepts: ["A swimming vehicle"]
Example 8.
- object: "a banana shaped apple"
- a banana shaped apple does not exist in reality, while the possibility of a banana shaped red object existing is much higher.
- main noun object: apple; context: banana shaped; replaced frequent object: red object
- frequent concepts: ["a banana shaped red object"]
Example 9.
- object: "a running dog"
- a running dog is not a rare concept.
- frequent concepts: []
Example 10.
- rare concept: "a tiger striped rock"
- a tiger striped rock does not exist in reality, while a tiger striped object does.
- main noun subject: rock; context: tiger striped; replaced frequent subject: object
- frequent concepts: ["a tiger striped object"]

STEP 6. Assign visual detail level to each frequent concept. 
A visual detail level denotes how much local visual detail is needed to draw the rare concept on a scale of 1 to 5.
The list of visual detail levels should be increasing.

Examples for STEP 6:
Example 1.
- object: "a crocodile made of glass"
- frequent concepts: ["an object made of glass", "an animal made of glass"]
- minimal local details are needed to draw the shape of a crocodile.
- visual detail levels: [1, 2]
Example 2.
- object: "a pigeon"
- frequent concepts: []
- visual detail levels: []
Example 3.
- object: "a cat with bat wings"
- frequent concepts: "an animal with bat wings"
- low local details are need for bat wings
- visual detail levels: [2]
Example 4.
- object: "A banana shaped apple"
- frequent concepts: ["A banana shaped red object"]
- minimal local details are needed to draw the rough shape of banana.
- visual detail levels: [1]
Example 5.
- object: "A swimming helicopter"
- frequent concepts: ["A swimming vehicle"]
- low local details are needed to draw the swimming action.
- visual detail levels: [2]
Example 6.
- object: "A horned frog"
- frequent concepts: ["A horned animal"]
- moderate local visual details are needed to draw horns.
- visual detail levels: [3]
Example 7.
- object: "A peach made of glass"
- frequent concepts: ["A pink sphere made of glass"]
- high local visual details are needed to draw the texture of glass.
- visual detail levels: [4]
Example 8.
- object: "A hairy frog"
- frequent concepts: ["A hairy animal"]
- extremely local visual details are needed to draw hairs.
- visual detail levels: [5]

STEP 7. Organize the information into a single JSON object.
The JSON object should be in the following form.
{
    "original_prompt": str,                        // The original prompt
    "base_prompt": str,                            // The base prompt generated in STEP 2
    "objects": {                                   // The objects appearing in the image
        "#1": {                                    // The first object
            "prompt": str,                         // The object prompt generated in STEP 3
            "object": str,                         // The object found in STEP 1
            "r2f": list[str],                      // The freqent concepts generated in STEP 5
            "visual_detail_levels": list[int],     // Visual detail levels assigned in STEP 6
            "bbox": [float, float, float, float],  // The bbox generated in STEP 4
        },
        "#2": {                                    // The second object
            ...
        },
        ...
    }
}

Example for STEP 7:
{
    "original_prompt": "a realistic photo of a pigeon and two cats with bat wings flying over a crocodile made of glass in the volcanic area",
    "base_prompt": "a realistic photo of #2, #3 and #4 flying over #1 in the volcanic area",
    "objects": {
        "#1": {
            "prompt": "a realistic photo of #1 in the volcanic area",
            "object": "a crocodile made of glass",
            "r2f": ["an object made of glass", "an animal made of glass"],
            "visual_detail_levels": [3, 4],
            "bbox": [0.5, 0.75, 0.4, 0.3]
        },
        "#2": {
            "prompt": "a realistic photo of #2 flying over the volcanic area",
            "object": "a pigeon",
            "r2f": [],
            "visual_detail_levels": [],
            "bbox": [0.8, 0.35, 0.2, 0.2]
        },
        "#3": {
            "prompt": "a realistic photo of #3 flying over the volcanic area",
            "object": "a cat with bat wings",
            "r2f": ["an animal with bat wings"],
            "visual_detail_levels": [3],
            "bbox": [0.2, 0.3, 0.2, 0.2]
        },
        "#4": {
            "prompt": "a realistic photo of #4 flying over the volcanic area",
            "object": "a cat with bat wings",
            "r2f": ["an animal with bat wings"],
            "visual_detail_levels": [3],
            "bbox": [0.5, 0.3, 0.2, 0.2]
        }
    }
}

STEP 8. Stringify the JSON object.

Example for STEP 8:
{'original_prompt': 'a realistic photo of a pigeon and two cats with bat wings flying over a crocodile made of glass in the volcanic area', 'base_prompt': 'a realistic photo of #2, #3 and #4 flying over #1 in the volcanic area', 'objects': {'#1': {'prompt': 'a realistic photo of #1 in the volcanic area', 'rare': 'a crocodile made of glass', 'freq': ['an object made of glass', 'an animal made of glass'], 'visual_detail_levels': [3, 4], 'bbox': [0.5, 0.75, 0.4, 0.3]}, '#2': {'prompt': 'a realistic photo of #2 flying over the volcanic area', 'rare': 'a pigeon', 'freq': [], 'visual_detail_levels': [], 'bbox': [0.8, 0.35, 0.2, 0.2]}, '#3': {'prompt': 'a realistic photo of #3 flying over the volcanic area', 'rare': 'a cat with bat wings', 'freq': ['an animal with bat wings'], 'visual_detail_levels': [3], 'bbox': [0.2, 0.3, 0.2, 0.2]}, '#4': {'prompt': 'a realistic photo of #4 flying over the volcanic area', 'rare': 'a cat with bat wings', 'freq': ['an animal with bat wings'], 'visual_detail_levels': [3], 'bbox': [0.5, 0.3, 0.2, 0.2]}}}

Original prompt: "{INPUT}"
Output: