Accelerating your advertising and marketing ideation with generative AI – Half 2: Generate customized advertising and marketing photos from historic references
Advertising groups face main challenges creating campaigns in in the present day’s digital atmosphere. They need to navigate by complicated information analytics and quickly altering client preferences to provide participating, personalised content material throughout a number of channels whereas sustaining model consistency and dealing inside tight deadlines. Utilizing generative AI can streamline and speed up the artistic course of whereas sustaining alignment with enterprise targets. Certainly, in accordance with McKinsey’s “The State of AI in 2023” report, 72% of organizations now combine AI into their operations, with advertising and marketing rising as a key space of implementation.
Constructing upon our earlier work of marketing campaign image generation using Amazon Nova foundation models, on this publish, we exhibit learn how to improve picture technology by studying from earlier advertising and marketing campaigns. We discover learn how to combine Amazon Bedrock, AWS Lambda, and Amazon OpenSearch Serverless to create a sophisticated picture technology system that makes use of reference campaigns to keep up model tips, ship constant content material, and improve the effectiveness and effectivity of recent marketing campaign creation.
The worth of earlier marketing campaign info
Historic marketing campaign information serves as a strong basis for creating efficient advertising and marketing content material. By analyzing efficiency patterns throughout previous campaigns, groups can determine and replicate profitable artistic parts that constantly drive larger engagement charges and conversions. These patterns would possibly embrace particular colour schemes, picture compositions, or visible storytelling methods that resonate with goal audiences. Earlier marketing campaign belongings additionally function confirmed references for sustaining constant model voice and visible identification throughout channels. This consistency is essential for constructing model recognition and belief, particularly in multi-channel advertising and marketing environments the place coherent messaging is important.
On this publish, we discover learn how to use historic marketing campaign belongings in advertising and marketing content material creation. We enrich reference photos with beneficial metadata, together with marketing campaign particulars and AI-generated picture descriptions, and course of them by embedding fashions. By integrating these reference belongings with AI-powered content material technology, advertising and marketing groups can remodel previous successes into actionable insights for future campaigns. Organizations can use this data-driven strategy to scale their advertising and marketing efforts whereas sustaining high quality and consistency, leading to extra environment friendly useful resource utilization and improved marketing campaign efficiency. We’ll exhibit how this systematic technique of utilizing earlier marketing campaign information can considerably improve advertising and marketing methods and outcomes.
Resolution overview
In our previous post, we carried out a advertising and marketing marketing campaign picture generator utilizing Amazon Nova Pro and Amazon Nova Canvas. On this publish, we discover learn how to improve this answer by incorporating a reference picture search engine that makes use of historic marketing campaign belongings to enhance technology outcomes. The next structure diagram illustrates the answer:
The primary structure parts are defined within the following listing:
- Our system begins with a web-based UI that customers can entry to start out the creation of recent advertising and marketing marketing campaign photos. Amazon Cognito handles person authentication and administration, serving to to make sure safe entry to the platform.
- The historic advertising and marketing belongings are uploaded to Amazon Simple Storage Service (Amazon S3) to construct a related reference library. This add course of is initiated by Amazon API Gateway. On this publish, we use the publicly accessible COCO (Common Objects in Context) dataset as our supply of reference photos.
- The picture processing AWS Step Functions workflow is triggered by API Gateway and processes photos in three steps:
- A Lambda perform (
DescribeImgFunction) makes use of the Amazon Nova Professional mannequin to explain the photographs and determine their key parts. - A Lambda perform (
EmbedImgFunction) transforms the photographs into embeddings utilizing the Amazon Titan Multimodal Embeddings basis mannequin. - A Lambda perform (
IndexDataFunction) shops the reference picture embeddings in an OpenSearch Serverless index, enabling fast similarity searches.
- A Lambda perform (
- This step bridges asset discovery and content material technology. When customers provoke a brand new marketing campaign, a Lambda perform (
GenerateRecommendationsFunction) transforms the marketing campaign necessities into vector embeddings and performs a similarity search within the OpenSearch Serverless index to determine probably the most related reference photos. The descriptions of chosen reference photos are then included into an enhanced immediate by a Lambda perform (GeneratePromptFunction). This immediate powers the creation of recent marketing campaign photos utilizing Amazon Bedrock by a Lambda perform (GenerateNewImagesFunction). For detailed details about the picture technology course of, see our previous blog.
Our answer is obtainable in GitHub. To deploy this venture, comply with the directions accessible within the README file.
Process
On this part, we study the technical parts of our answer, from reference picture processing by closing advertising and marketing content material technology.
Analyzing the reference picture dataset
Step one in our AWS Step Features workflow is analyzing reference photos utilizing the Lambda Operate DescribeImgFunction. This useful resource makes use of Amazon Nova Pro 1.0 to generate two key parts for every picture: an in depth description and an inventory of parts current within the picture. These metadata parts might be built-in into our vector database index later and used for creating new marketing campaign visuals.
For implementation particulars, together with the whole immediate template and Lambda perform code, see our GitHub repository. The next is the structured output generated by the perform when offered with a picture:
Producing reference picture embeddings
The Lambda perform EmbedImgFunction encodes the reference photos into vector representations utilizing the Amazon Titan Multimodal Embeddings mannequin. This mannequin can embed each modalities right into a joint house the place textual content and pictures are represented as numerical vectors in the identical dimensional house. On this unified illustration, semantically comparable objects (whether or not textual content or photos) are positioned nearer collectively. The mannequin preserves semantic relationships inside and throughout modalities, enabling direct comparisons between any mixture of photos and textual content. This permits highly effective capabilities equivalent to text-based picture search, picture similarity search, and mixed textual content and picture search.
The next code demonstrates the important logic for changing photos into vector embeddings. For the whole implementation of the Lambda perform, see our GitHub repository.
with open(image_path, "rb") as image_file:
input_image = base64.b64encode(image_file.learn()).decode('utf8')
response = bedrock_runtime.invoke_model(
physique=json.dumps({
"inputImage": input_image,
"embeddingConfig": {
"outputEmbeddingLength": dimension
}
}),
modelId=model_id
)
json.hundreds(response.get("physique").learn())
The perform outputs a structured response containing the picture particulars and its embedding vector, as proven within the following instance.
Index reference photos with Amazon Bedrock and OpenSearch Serverless
Our answer makes use of OpenSearch Serverless to allow environment friendly vector search capabilities for reference photos. This course of entails two major steps: establishing the search infrastructure after which populating it with reference picture information.
Creation of the search index
Earlier than indexing our reference photos, we have to arrange the suitable search infrastructure. When our stack is deployed, it provisions a vector search assortment in OpenSearch Serverless, which robotically handles scaling and infrastructure administration. Inside this assortment, we create a search index utilizing the Lambda perform CreateOpenSearchIndexFn.
Our index mappings configuration, proven within the following code, defines the vector similarity algorithm and the marketing campaign metadata fields for filtering. We use the Hierarchical Navigable Small World (HNSW) algorithm, offering an optimum stability between search velocity and accuracy. The marketing campaign metadata contains an goal discipline that captures marketing campaign objectives (equivalent to clicks, consciousness, or likes) and a node discipline that identifies goal audiences (equivalent to followers, clients, or new clients). By filtering search outcomes utilizing these fields, we may also help be sure that reference photos come from campaigns with matching targets and goal audiences, sustaining alignment in our advertising and marketing strategy.
For the whole implementation particulars, together with index settings and extra configurations, see our GitHub repository.
Indexing reference photos
With our search index in place, we will now populate it with reference picture information. The Lambda perform IndexDataFunction handles this course of by connecting to the OpenSearch Serverless index and storing every picture’s vector embedding alongside its metadata (marketing campaign targets, audience, descriptions, and different related info). We will use this listed information later to rapidly discover related reference photos when creating new advertising and marketing campaigns. Beneath is a simplified implementation, with the whole code accessible in our GitHub repository:
# Initialize the OpenSearch shopper
oss_client = OpenSearch(
hosts=[{'host': OSS_HOST, 'port': 443}],
http_auth=AWSV4SignerAuth(boto3.Session().get_credentials(), area, 'aoss'),
use_ssl=True,
verify_certs=True,
connection_class=RequestsHttpConnection
)
# Put together doc for indexing
doc = {
"id": image_id,
"node": metadata['node'],
"goal": metadata['objective'],
"image_s3_uri": s3_url,
"image_description": description,
"img_element_list": parts,
"embeddings": embedding_vector
}
# Index doc in OpenSearch
oss_response = oss_client.index(
index=OSS_EMBEDDINGS_INDEX_NAME,
physique=doc
)
Combine the search engine into the advertising and marketing campaigns picture generator
The picture technology workflow combines marketing campaign necessities with insights from earlier reference photos to create new advertising and marketing visuals. The method begins when customers provoke a brand new marketing campaign by the online UI. Customers present three key inputs: a textual content description of their desired marketing campaign, its goal, and its node. Utilizing these inputs, we carry out a vector similarity search in OpenSearch Serverless to determine probably the most related reference photos from our library. For these chosen photos, we retrieve their descriptions (created earlier by Lambda perform DescribeImgFunction) and incorporate them into our immediate engineering course of. The ensuing enhanced immediate serves as the inspiration for producing new marketing campaign photos that align with each: the person’s necessities and profitable reference examples. Let’s study every step of this course of intimately.
Get picture suggestions
When a person defines a brand new marketing campaign description, the Lambda perform GetRecommendationsFunction transforms it right into a vector embedding utilizing the Amazon Titan Multimodal Embeddings mannequin. By reworking the marketing campaign description into the identical vector house as our picture library, we will carry out exact similarity searches and determine reference photos that intently align with the marketing campaign’s targets and visible necessities.
The Lambda perform configures the search parameters, together with the variety of outcomes to retrieve and the okay worth for the k-NN algorithm. In our pattern implementation, we set okay to 5, retrieving the highest 5 most comparable photos. These parameters might be adjusted to stability outcome range and relevance.
To assist guarantee contextual relevance, we apply filters to match each the node (audience) and goal of the brand new marketing campaign. This strategy ensures that beneficial photos usually are not solely visually comparable but in addition aligned with the marketing campaign’s particular objectives and audience. We showcase a simplified implementation of our search question, with the whole code accessible in our GitHub repository.
physique = {
"dimension": okay,
"_source": {"exclude": ["embeddings"]},
"question":
{
"knn":
{
"embeddings": {
"vector": embedding,
"okay": okay,
}
}
},
"post_filter": {
"bool": {
"filter": [
{"term": {"node": node}},
{"term": {"objective": objective}}
]
}
}
}
res = oss_client.search(index=OSS_EMBEDDINGS_INDEX_NAME, physique=physique)
The perform processes the search outcomes, that are saved in Amazon DynamoDB to keep up a persistent document of campaign-image associations for environment friendly retrieval. Customers can entry these suggestions by the UI and choose which reference photos to make use of for his or her new marketing campaign creation.
Enhancing the meta-prompting method with reference photos
The immediate technology part builds upon our meta-prompting method launched in our previous blog. Whereas sustaining the identical strategy with Amazon Nova Pro 1.0, we now improve the method by incorporating descriptions from user-selected reference photos. These descriptions are built-in into the template immediate utilizing XML tags (<related_images>), as proven within the following instance.
The immediate technology is orchestrated by the Lambda perform GeneratePromptFunction. The perform receives the marketing campaign ID and the URLs of chosen reference photos, retrieves their descriptions from DynamoDB, and makes use of Amazon Nova Pro 1.0 to create an optimized immediate from the earlier template. This immediate is used within the subsequent picture technology part. The code implementation of the Lambda perform is obtainable in our GitHub repository.
Picture technology
After acquiring reference photos and producing an enhanced immediate, we use the Lambda perform GenerateNewImagesFunction to create the brand new marketing campaign picture. This perform makes use of Amazon Nova Canvas 1.0 to generate a closing visible asset that comes with insights from profitable reference campaigns. The implementation follows the picture technology course of we detailed in our previous blog. For the whole Lambda perform code, see our GitHub repository.
Creating a brand new advertising and marketing marketing campaign: An end-to-end instance
We developed an intuitive interface that guides customers by the marketing campaign creation course of. The interface handles the complexity of AI-powered picture technology, solely requiring customers to offer their marketing campaign description and fundamental particulars. We stroll by the steps to create a advertising and marketing marketing campaign utilizing our answer:
- Customers start by defining three key marketing campaign parts:
- Marketing campaign description: An in depth temporary that serves as the inspiration for picture technology.
- Marketing campaign goal: The advertising and marketing intention (for instance, Consciousness) that guides the visible technique.
- Goal node: The particular viewers section (for instance, Clients) for content material focusing on.
- Primarily based on the marketing campaign particulars, the system presents related photos from earlier profitable campaigns. Customers can evaluation and choose the photographs that align with their imaginative and prescient. These alternatives will information the picture technology course of.
- Utilizing the marketing campaign description and chosen reference photos, the system generates an enhanced immediate that serves because the enter for the ultimate picture technology step.
- Within the closing step, our system generates visible belongings based mostly on the immediate that would probably be used as inspiration for an entire marketing campaign briefing.
How Bancolombia is utilizing Amazon Nova to streamline their advertising and marketing marketing campaign belongings technology
Bancolombia, one among Colombia’s main banks, has been experimenting with this advertising and marketing content material creation strategy for greater than a 12 months. Their implementation offers beneficial insights into how this answer might be built-in into established advertising and marketing workflows. Bancolombia has been capable of streamline their artistic workflow whereas making certain that the generated visuals align with the marketing campaign’s strategic intent. Juan Pablo Duque, Advertising Scientist Lead at Bancolombia, shares his perspective on the influence of this know-how:
“For the Bancolombia crew, leveraging historic imagery was a cornerstone in constructing this answer. Our purpose was to immediately sort out three main business ache factors:
- Lengthy and dear iterative processes: By implementing meta-prompting methods and making certain strict model tips, we’ve considerably diminished the time customers spend producing high-quality photos.
- Problem sustaining context throughout artistic variations: By figuring out and locking in key visible parts, we guarantee seamless consistency throughout all graphic belongings.
- Lack of management over outputs: The suite of methods built-in into our answer offers customers with a lot better precision and management over the outcomes.
And that is only the start. This train permits us to validate new AI creations towards our present library, making certain we don’t over-rely on the identical visuals and protecting our model’s look contemporary and fascinating.”
Clear up
To keep away from incurring future costs, you need to delete all of the sources used on this answer. As a result of the answer was deployed utilizing a number of AWS CDK stacks, you need to delete them within the reverse order of deployment to correctly take away all sources. Comply with these steps to wash up your atmosphere:
- Delete the frontend stack:
- Delete the picture technology backend stack:
- Delete the picture indexing backend stack:
- Delete the OpenSearch roles stack:
The cdk destroy command will take away most sources robotically, however there is likely to be some sources that require handbook deletion equivalent to S3 buckets with content material and OpenSearch collections. Ensure to test the AWS Administration Console to confirm that each one sources have been correctly eliminated. For extra details about the cdk destroy command, see the AWS CDK Command Line Reference.
Conclusion
This publish has offered an answer that enhances advertising and marketing content material creation by combining generative AI with insights from historic campaigns. Utilizing Amazon OpenSearch Serverless and Amazon Bedrock, we constructed a system that effectively searches and makes use of reference photos from earlier advertising and marketing campaigns. The system filters these photos based mostly on marketing campaign targets and goal audiences, serving to to make sure strategic alignment. These references then feed into our immediate engineering course of. Utilizing Amazon Nova Professional, we generate a immediate that mixes new marketing campaign necessities with insights from profitable previous campaigns, offering model consistency within the closing picture technology.
This implementation represents an preliminary step in utilizing generative AI for advertising and marketing. The whole answer, together with detailed implementations of the Lambda capabilities and configuration information, is obtainable in our GitHub repository for adaptation to particular organizational wants.
For extra info, see the next associated sources:
In regards to the authors
María Fernanda Cortés is a Senior Knowledge Scientist on the Skilled Providers crew of AWS. She’s centered on designing and creating end-to-end AI/ML options to handle enterprise challenges for purchasers globally. She’s obsessed with scientific data sharing and volunteering in technical communities.
David Laredo is a Senior Utilized Scientist at Amazon, the place he helps innovate on behalf of consumers by the appliance of state-of-the-art methods in ML. With over 10 years of AI/ML expertise David is a regional technical chief for LATAM who consistently produces content material within the type of blogposts, code samples and public talking periods. He at present leads the AI/ML skilled group in LATAM.
Adriana Dorado is a Pc Engineer and Machine Studying Technical Area Neighborhood (TFC) member at AWS, the place she has been for five years. She’s centered on serving to small and medium-sized companies and monetary companies clients to architect on the cloud and leverage AWS companies to derive enterprise worth. Outdoors of labor she’s obsessed with serving because the Vice President of the Society of Girls Engineers (SWE) Colombia chapter, studying science fiction and fantasy novels, and being the proud aunt of an exquisite niece.
Yunuen Piña is a Options Architect at AWS, specializing in serving to small and medium-sized companies throughout Mexico to rework their concepts into progressive cloud options that drive enterprise progress.
Juan Pablo Duque is a Advertising Science Lead at Bancolombia, the place he merges science and advertising and marketing to drive effectivity and effectiveness. He transforms complicated analytics into compelling narratives. Keen about GenAI in MarTech, he writes informative weblog posts. He leads information scientists devoted to reshaping the advertising and marketing panorama and defining new methods to measure.





