1.1.4 Firefly Custom Models API
1.1.4.1 What are Firefly Custom Models?
With Firefly custom models, you can generate image variations that align with your brand using the Text to image feature. By training these models with your own images, you can generate content that reflects your brand’s identity.
Transform your style or subject to explore new ideas, visualize different surroundings, generate innovative content, and tailor content to specific segments.
With Firefly Custom Models you can…
- Create on-brand ideas and concepts
- Produce character themes with consistent styles
- Create consistent brand styles to quickly expand campaigns
To achieve this, Firefly Custom Models support:
- Custom subject models
- Custom style models
Custom subject models
When training custom models on a specific subject — whether objects or characters — the goal is to identify the subject’s essential features and help the model replicate them across various contexts and positions.
Look for images with the following characteristics when training a subject model:
- Object consistency: Provide images of the same make and model as your subject while ensuring that the subject doesn’t look widely different across images. Avoid mixing multiple colors and ensure a common theme or pattern among images. However, your subject can vary across scenes, poses, clothing, and background.
- Object focus: Use images of the subject in clear focus without unnecessary distractions. Keep the subject near the center of the image and make sure that it occupies at least 25% of the image’s area.
- Environmental context: Provide images of the subject in different views and contexts, showing it in a variety of lighting conditions. While images with white or transparent backgrounds can be used, it’s best to have a mix with more complex surroundings as well.
- Avoid other objects: Avoid large items in the background or associated with the character. Any large item shown in the images is memorized by the model and will appear in the generated images, similar to the same item in the training dataset.
Custom style models
Custom models trained on a style will identify the look and feel of the assets to generate similar images when prompted.
To train an effective style model:
- Provide similar aesthetics: Include images that show various scenes and objects while maintaining the same look and feel.
- Use various images: Use as many images as you can to prevent the model from focusing too much on unwanted objects or subjects.
- Avoid any fixed phrases: A fixed pattern has a bigger weight than other phrases. For example, if every caption contains “The background is solid black” or “cute cartoon styles” the model will depend on this phrase, and any testing prompt without it will not generate the desired results.
1.1.4.2 Configure your Custom Model
Go to https://firefly.adobe.com/. Click Custom Models.
You may see this message. If you do, click Agree to continue.
You should then see this. Click Train a model.
Configure the following fields:
- Name: use
--aepUserLdap-- - Citi Signal Router Model
- Training Mode: select Subject (tech preview)
- Concept: enter
router
- Save to: open the dropdown list and click + Create New Project
Give the new project a name: --aepUserLdap-- - Custom Models
. Click Create.
You should then see this. Click Continue.
You now need to provide the reference images for the Custom Model to be trained. Click Select images from your computer.
Download the reference images here. Unzip the download file, which whould give you this.
Navigate to the folder that contains the download image files. Select them all and click Open.
You’ll then see that your images are being loaded.
After a couple of minutes, your images are loaded correctly. You may see that some images have an error, this is due to the caption for the image not having been generated, or not being long enough. Review each image with an error and enter a caption that meets the requirements and describes the image.
Once all images have captions that meet the requirements, you still need to provide a sample prompt. Enter any prompt that uses the word ‘router’. Once you’ve done that, you can start training your model. Click Train.
You’ll then see this. Training your model may take 20-30mins or longer.
After 20-30mins, your model is now trained and can be published. Click Publish.
Click Publish again.
Close the Share custom model popup.
1.1.4.3 Use your Custom Model in the UI
Go to https://firefly.adobe.com/cme/train. Click your Custom Model to open it.
Click Preview and test.
You’ll then see the sample prompt that you entered before being executed.
1.1.4.4 Enable your Custom Model for Firefly Services Custom Models API
Once your Custom Model is trained, it can also be used through the API. In exercise 1.1.1 you already configured your Adobe I/O project for interaction with Firefly Services through the API.
Go to https://firefly.adobe.com/cme/train. Click your Custom Model to open it.
Click the 3 dots … and then click Share.
In order to access a Firefly Custom Model, the Custom Model needs to be shared to the Technical Account Email of your Adobe I/O Project.
To retrieve your Technical Account Email, go to https://developer.adobe.com/console/projects. Click to open your Project, which is named --aepUserLdap-- One Adobe tutorial
.
Click OAuth Server-to-Server.
Click to copy your Technical Account Email.
Paste your Technical Account Email and click Invite to edit.
The Technical Account Email should now be able to access the Custom Model.
1.1.4.5 Interact with Firefly Services Custom Models API
In Exercise 1.1.1 Getting started with Firefly Services, you downloaded this file: postman-ff.zip to your local desktop and you then imported that collection in Postman.
Open Postman and go to the folder FF - Custom Models API.
Open the request 1. FF - getCustomModels and click Send.
You should see the Custom Model that you created before, which is named --aepUserLdap-- - Citi Signal Router Model
, as part of the response. The field assetId is the unique identifier of your Custom Model, which will be referenced in the next request.
Open the request 2. Generate Images Async. In this example, you’ll request 2 variations to be generated based on your Custom Model. Feel free to update the prompt which in this case is a white router on a volcano in Africa
.
Click Send.
The response contains a field jobId. The job to generate these 2 images is now running and you can check the status by using the next request.
Open the request 3. Get CM Status and click Send. You should then see that the status is set to running.
After a couple of minutes, click Send again for the request 3. Get CM Status. You should then see that the status changed to succeeded and you should see two image URLs as part of the output. Click to open both files.
This is the first image that was generated in this example.
This is the second image that was generated in this example.
You’ve now completed this exercise.
Next Steps
Go to Summary & benefits
Go back to Working with Photoshop APIs
Go back to Overview of Adobe Firefly Services