WEBVTT

00:01.260 --> 00:03.180
-: Hey, I'm gonna show you how to use AI

00:03.180 --> 00:07.200
to tell what's performing inside of your creative images.

00:07.200 --> 00:10.845
So we're gonna use Google's vision API,

00:10.845 --> 00:15.060
and to do that we just need to run

00:15.060 --> 00:16.575
PIP store, Google Cloud Vision.

00:16.575 --> 00:19.710
It's gonna install the library that we need.

00:19.710 --> 00:23.605
And then we're gonna just import these libraries here.

00:23.605 --> 00:25.140
So when you're running these cells,

00:25.140 --> 00:27.840
it's literally just click into the cell and shift enter,

00:27.840 --> 00:29.700
or command enter if you're on a Mac

00:29.700 --> 00:31.473
or you can click play here.

00:32.400 --> 00:35.605
So what we're gonna do is we're gonna pull

00:35.605 --> 00:39.325
the campaign stats, the campaign results in first.

00:39.325 --> 00:42.600
So this is the performance data

00:42.600 --> 00:44.430
that you get from your campaign.

00:44.430 --> 00:48.215
So here we have like a specific ID for each creative

00:48.215 --> 00:50.525
that we ran, that each one of these is an image

00:50.525 --> 00:52.080
and we've got the reach impressions,

00:52.080 --> 00:55.065
clicks, spend, conversions, whatever else you need.

00:55.065 --> 00:57.960
So before we can do that, we need to upload it

00:57.960 --> 01:00.420
and you should be able to see that.

01:00.420 --> 01:03.240
We can see the campaign results, CSV here.

01:03.240 --> 01:04.650
So what we need to do,

01:04.650 --> 01:06.210
if you're in the notebook,

01:06.210 --> 01:08.667
it might just have something like this.

01:08.667 --> 01:12.660
You just click on the folder and then click upload,

01:12.660 --> 01:16.680
and then you can kind of choose the file to upload it there.

01:16.680 --> 01:19.050
You also want to do that for the images.

01:19.050 --> 01:24.050
So you're gonna get a link to all the images in this folder.

01:24.870 --> 01:27.330
I've got all the images here,

01:27.330 --> 01:29.280
look, they're on my computer.

01:29.280 --> 01:32.365
So you can see these are just the different ads that we ran,

01:32.365 --> 01:34.165
you know, for our campaign.

01:34.165 --> 01:35.970
And we wanna know, okay,

01:35.970 --> 01:39.240
is it pictures of women or men

01:39.240 --> 01:40.537
or is it kind of like...

01:40.537 --> 01:42.533
You know, what style of images

01:42.533 --> 01:44.220
worked really well for our campaigns?

01:44.220 --> 01:45.930
Or was it these kind of, you know,

01:45.930 --> 01:49.200
clay emoji style images that worked?

01:49.200 --> 01:54.200
And you know, obviously there's like 20 ads here.

01:54.240 --> 01:57.600
Yeah, you could go through and kinda manually tag them,

01:57.600 --> 01:59.575
but it might be interesting to see

01:59.575 --> 02:01.715
what the AI comes up with.

02:01.715 --> 02:04.800
So once you've uploaded,

02:04.800 --> 02:07.860
you can just run this and get the campaign results.

02:07.860 --> 02:09.305
And then what we're gonna do is we're gonna use Google

02:09.305 --> 02:11.790
Vision to tag each image

02:11.790 --> 02:14.820
and then join that to the campaign results.

02:14.820 --> 02:18.030
So what this is doing is just running through

02:18.030 --> 02:20.820
and once you've uploaded all the images,

02:20.820 --> 02:23.820
so you know, in this case, you'd click upload

02:23.820 --> 02:26.045
and then find all the images on your computer

02:26.045 --> 02:27.963
and then upload 'em that way.

02:28.855 --> 02:32.520
This is gonna make sure that you have all those images.

02:32.520 --> 02:35.100
So it's just gonna run through,

02:35.100 --> 02:38.880
look in this folder in the Google Colab notebook,

02:38.880 --> 02:41.790
and then it's just gonna kind of find everything

02:41.790 --> 02:44.245
that's a PNG in that folder.

02:44.245 --> 02:45.895
So don't worry too much about how this works,

02:45.895 --> 02:49.560
it's just gonna display them with the name here.

02:49.560 --> 02:51.753
So just gonna let that run.

02:52.710 --> 02:53.610
Here we go.

02:53.610 --> 02:54.810
Okay, so you can see what all the

02:54.810 --> 02:55.965
different images look like.

02:55.965 --> 02:57.690
This is useful because sometimes you

02:57.690 --> 02:58.830
need to remind yourself like

02:58.830 --> 03:02.475
What ad did we run for that campaign?

03:02.475 --> 03:03.308
Cool.

03:03.308 --> 03:05.550
The other thing you need to do is

03:05.550 --> 03:07.860
get a service account, JSON.

03:07.860 --> 03:11.310
So this is basically like a password,

03:11.310 --> 03:13.545
but it's a file that you can save.

03:13.545 --> 03:17.190
So if you go to this page here,

03:17.190 --> 03:18.023
there's a link,

03:18.865 --> 03:20.580
it tells you how to get started.

03:20.580 --> 03:22.500
So if you haven't set up a Google Cloud

03:22.500 --> 03:25.320
console project before,

03:25.320 --> 03:27.390
it's gonna walk you through how to do that.

03:27.390 --> 03:28.980
You need to enable billing.

03:28.980 --> 03:30.150
So it doesn't work

03:30.150 --> 03:32.160
unless you don't have a credit card behind it.

03:32.160 --> 03:34.080
It's not really gonna cost you very much

03:34.080 --> 03:36.690
unless you do something hilariously wrong.

03:36.690 --> 03:38.719
But you know, for me it's like,

03:38.719 --> 03:40.320
I think a couple cents.

03:40.320 --> 03:41.760
And you usually get some credit

03:41.760 --> 03:43.680
that you can use like a few hundred dollars

03:43.680 --> 03:46.660
when you set up the Google Cloud project.

03:46.660 --> 03:47.764
You can also...

03:47.764 --> 03:50.428
The next thing you need to do is enable the API.

03:50.428 --> 03:52.665
So literally, if you click on this,

03:52.665 --> 03:56.400
it will actually just kind of look at the project

03:56.400 --> 03:59.520
and then it's gonna confirm, you know,

03:59.520 --> 04:02.640
within your project if you are happy to enable it.

04:02.640 --> 04:05.105
So that's the next thing you do.

04:05.105 --> 04:06.840
And that's just kind of a fail safe

04:06.840 --> 04:08.705
to make sure you don't use the wrong APIs.

04:08.705 --> 04:13.530
And then the next thing you do is get a service account key.

04:13.530 --> 04:17.370
So if you click go to create service accounts,

04:17.370 --> 04:21.000
then that's gonna kind of give you the different projects

04:21.000 --> 04:22.290
and you're gonna choose that.

04:22.290 --> 04:23.940
And then you're gonna go through this flow

04:23.940 --> 04:26.850
and just create and continue.

04:26.850 --> 04:29.325
Once you've got a service account,

04:29.325 --> 04:33.250
then you basically just need to click into it

04:35.940 --> 04:39.660
and then you wanna go to Keys,

04:39.660 --> 04:43.380
and then you can download a key here.

04:43.380 --> 04:46.455
So you can go add a key, create a new key,

04:46.455 --> 04:49.695
and I'm gonna delete mine after this.

04:49.695 --> 04:52.383
So, you know, don't worry,

04:53.550 --> 04:55.865
you won't be able to access.

04:55.865 --> 04:57.630
Yeah, because I'll have it deleted

04:57.630 --> 04:59.580
by the time I put the video live

04:59.580 --> 05:02.520
and I recommend you don't share yours with anyone.

05:02.520 --> 05:04.860
But once you have the key...

05:04.860 --> 05:07.050
So like if I create a new key,

05:07.050 --> 05:08.970
it'll say like, create,

05:08.970 --> 05:12.630
and then it'll download some JSON to my folder.

05:12.630 --> 05:15.540
And then you basically just then upload it here.

05:15.540 --> 05:17.160
I've renamed it.

05:17.160 --> 05:19.255
So you can click into a file and go rename

05:19.255 --> 05:22.740
and I've renamed it "Service account JSON,"

05:22.740 --> 05:23.855
just to make the code run.

05:23.855 --> 05:25.515
But you can just set yours

05:25.515 --> 05:29.310
to whatever your thing is named here.

05:29.310 --> 05:34.310
So if you run that fine and then you go in here.

05:34.710 --> 05:37.260
So this is the actual code that finds the labels.

05:37.260 --> 05:38.610
So this is just a test run.

05:38.610 --> 05:40.710
We'll try it with one of the images.

05:40.710 --> 05:42.720
In this case it's gonna be,

05:42.720 --> 05:44.043
let's say image 10.

05:44.970 --> 05:47.395
So or the, I guess that's the 11th image

05:47.395 --> 05:49.890
because it starts counting from zero.

05:49.890 --> 05:52.375
So it's gonna open the image.

05:52.375 --> 05:54.570
So it's gonna read the image,

05:54.570 --> 05:58.980
then it's gonna turn that into a Google vision image.

05:58.980 --> 06:00.660
And then when it's in that format,

06:00.660 --> 06:03.870
then you can get the label detection running.

06:03.870 --> 06:05.940
And there's actually a bunch of other things you can do

06:05.940 --> 06:07.350
with this, but label detection

06:07.350 --> 06:09.450
is the most immediately useful.

06:09.450 --> 06:11.700
And then once you get the response,

06:11.700 --> 06:14.940
so this calls the API for Google Vision

06:14.940 --> 06:16.470
and it takes a few seconds,

06:16.470 --> 06:18.810
you get the response and then you can get the labels

06:18.810 --> 06:20.250
as well as other things as well.

06:20.250 --> 06:22.770
But labels is all we need.

06:22.770 --> 06:24.570
And then what we're gonna do

06:24.570 --> 06:25.485
here is just to test, it's working.

06:25.485 --> 06:27.405
We're just gonna display the image

06:27.405 --> 06:28.920
with the labels underneath.

06:28.920 --> 06:31.203
So let's run that and see if it's working.

06:32.841 --> 06:33.674
Here we go.

06:33.674 --> 06:34.507
Yeah, it worked.

06:34.507 --> 06:35.640
So this was our image.

06:35.640 --> 06:37.920
And then we got the labels of hair,

06:37.920 --> 06:40.290
joint, head, shoulder, eye,

06:40.290 --> 06:41.310
flash photography, neck,

06:41.310 --> 06:42.336
sleeve, dress, thigh,

06:42.336 --> 06:44.970
and we can check other images as well.

06:44.970 --> 06:47.313
So lemme try another one.

06:48.990 --> 06:50.850
This is the first image.

06:50.850 --> 06:51.843
So zero.

06:52.830 --> 06:56.370
So this is a lemon, picked up the blue

06:56.370 --> 06:58.620
and the sphere and still life.

06:58.620 --> 07:01.260
And then you can just basically, you know,

07:01.260 --> 07:04.365
kind of try out all the different images if you like,

07:04.365 --> 07:06.510
kinda see what it comes up with.

07:06.510 --> 07:09.035
It's not always fully accurate.

07:09.035 --> 07:12.305
I think it's a good kind of directional understanding.

07:12.305 --> 07:14.640
Sometimes it doesn't get them right.

07:14.640 --> 07:16.505
These images themselves are actually

07:16.505 --> 07:18.300
generated by AI as well.

07:18.300 --> 07:22.470
So sometimes it does get confused on these

07:22.470 --> 07:27.470
more than it does with the real images that you know

07:28.380 --> 07:30.360
that you would use from your account.

07:30.360 --> 07:31.193
Cool.

07:31.193 --> 07:32.310
So now that we know it's working,

07:32.310 --> 07:34.650
we can just run this to process all the images.

07:34.650 --> 07:37.020
So it's gonna go through every single image

07:37.020 --> 07:38.940
and do the same thing again.

07:38.940 --> 07:41.280
Except instead of just printing the labels,

07:41.280 --> 07:42.810
although it will print them,

07:42.810 --> 07:45.360
it will also then add them to a list.

07:45.360 --> 07:47.115
And then we're gonna use that list afterwards

07:47.115 --> 07:49.535
to join the data together.

07:49.535 --> 07:51.300
So I'm not gonna run that again

07:51.300 --> 07:53.885
because it's already run here,

07:53.885 --> 07:55.380
takes a few minutes,

07:55.380 --> 07:57.870
but it depends on how many images you have.

07:57.870 --> 07:59.100
But you can see that, you know...

07:59.100 --> 08:00.960
Here it can tell that that's a peach,

08:00.960 --> 08:02.880
which is pretty cool.

08:02.880 --> 08:06.655
It thinks that this is a toy or maybe some office supplies.

08:06.655 --> 08:09.420
So you can see this isn't quite get it,

08:09.420 --> 08:12.000
but you know, these, I think these fashion photography ones

08:12.000 --> 08:15.120
seem to work a little bit better.

08:15.120 --> 08:18.003
So, you know, it's picking up quite a few things here.

08:18.870 --> 08:20.610
So it's quite interesting.

08:20.610 --> 08:22.775
So you can see all the logos as it comes through.

08:22.775 --> 08:26.670
And then if you scroll down to the end,

08:26.670 --> 08:27.840
now this is where we start

08:27.840 --> 08:29.340
to get the data into the right format.

08:29.340 --> 08:33.690
So what this does is it just goes through every label

08:33.690 --> 08:37.050
and then for every label it adds it with the creative.

08:37.050 --> 08:39.973
So you know, if C 39 had, you know,

08:39.973 --> 08:44.175
C 39 creative had the label of ball and solo photography

08:44.175 --> 08:47.100
and circle and sphere and electric blue.

08:47.100 --> 08:49.210
So this just showing the first five rows

08:50.070 --> 08:53.910
and then we're basically gonna then join that together

08:53.910 --> 08:58.020
with our other data, the metrics DF,

08:58.020 --> 08:59.850
which was the impression,

08:59.850 --> 09:01.220
click, spend, et cetera.

09:01.220 --> 09:03.900
So that just does merge.

09:03.900 --> 09:05.070
And there we go.

09:05.070 --> 09:09.415
Now we can see, 'cause C 39 had the label of ball,

09:09.415 --> 09:13.920
we've given that the metrics from C 39

09:13.920 --> 09:16.745
and it's given that for each one of the labels.

09:16.745 --> 09:19.290
And then what we're gonna do is kind of join it all together

09:19.290 --> 09:23.370
so that, you know, if multiple creators had, you know,

09:23.370 --> 09:25.230
the circle label,

09:25.230 --> 09:27.545
then they're gonna add up all of their metrics.

09:27.545 --> 09:29.583
So that's what this does here,

09:30.840 --> 09:32.280
it's gonna run this.

09:32.280 --> 09:33.780
And there we go.

09:33.780 --> 09:36.990
So this is kind of the beginning of the table

09:36.990 --> 09:39.840
and what this has done is it's kind of grouped

09:39.840 --> 09:44.280
by the creative and then just counted how many creatives

09:44.280 --> 09:47.190
it was in and kind of spat back

09:47.190 --> 09:48.900
which creatives it was in as well.

09:48.900 --> 09:53.430
So seeking the action figure was in C 44,

09:53.430 --> 09:55.020
an arm was tagged in C3,

09:55.020 --> 09:56.493
C 34, and C 25.

09:57.968 --> 10:01.530
So we're gonna use that in a second.

10:01.530 --> 10:04.745
The only thing left to do really is to

10:04.745 --> 10:06.665
attach all the metrics.

10:06.665 --> 10:10.590
So again, this is just going through each column

10:10.590 --> 10:14.010
and then getting just the metrics data,

10:14.010 --> 10:18.030
so from column to onwards and then grouping by

10:18.030 --> 10:21.510
and summing it and then kind of adding it into that column.

10:21.510 --> 10:24.420
So every creative, so you know,

10:24.420 --> 10:26.310
this one action figure,

10:26.310 --> 10:28.143
it was just in creative C 44.

10:29.400 --> 10:33.480
The reach impressions clicks will be just from C 44,

10:33.480 --> 10:37.020
but this one arm was in C 3, C 34, and C 25.

10:37.020 --> 10:38.970
So it has the combination,

10:38.970 --> 10:41.250
the sum of all those metrics.

10:41.250 --> 10:42.125
The other thing I did was just

10:42.125 --> 10:43.925
calculated the click-through rate.

10:43.925 --> 10:45.270
That's what I'm gonna look at for this.

10:45.270 --> 10:47.940
We don't have a lot of conversions,

10:47.940 --> 10:50.190
but here it's just the clicks divided

10:50.190 --> 10:52.050
by impressions times by a hundred.

10:52.050 --> 10:54.450
And that's what I'm kind of using to tell

10:54.450 --> 10:56.830
which creatives were good or not.

10:56.830 --> 10:57.663
Cool.

10:57.663 --> 10:59.130
So one thing you'll notice is that like,

10:59.130 --> 11:00.360
if it's only in one creative,

11:00.360 --> 11:01.590
it doesn't tell as much.

11:01.590 --> 11:03.570
So it's saying action figures, you know,

11:03.570 --> 11:05.490
ranked the same as art,

11:05.490 --> 11:07.560
1.18% click through rate.

11:07.560 --> 11:09.990
'Cause that was the click through rate for this one ad.

11:09.990 --> 11:12.750
So what's more interesting if it's in multiple creators,

11:12.750 --> 11:14.040
but it wouldn't be that interesting

11:14.040 --> 11:15.270
if it was in all the creatives

11:15.270 --> 11:17.070
'cause then that would just be the average, right?

11:17.070 --> 11:20.790
So what we want is any, you know,

11:20.790 --> 11:22.565
we don't want it in all creatives.

11:22.565 --> 11:27.095
So this is saying basically filter for any time

11:27.095 --> 11:31.110
where the creative count was equal

11:31.110 --> 11:33.675
or you know, it's basically it needs to be

11:33.675 --> 11:36.905
less than the length of creative names.

11:36.905 --> 11:38.090
And then this three

11:38.090 --> 11:41.430
or more filter basically, you know,

11:41.430 --> 11:46.430
needs to have at least three in the creative count call.

11:47.400 --> 11:49.037
Cool, so then the filter DF,

11:49.037 --> 11:51.450
I've also sorted it by values.

11:51.450 --> 11:53.700
So sorted by click through rate descending,

11:53.700 --> 11:55.620
and then that shows the head here.

11:55.620 --> 11:58.440
So you can run that and you can see,

11:58.440 --> 11:59.280
there we go.

11:59.280 --> 12:02.626
And now we can start to tell, you know,

12:02.626 --> 12:06.325
what types of tags are showing up as performant.

12:06.325 --> 12:09.420
And you could look at the head

12:09.420 --> 12:13.740
and see that this one has like,

12:13.740 --> 12:15.150
it's only in three creatives,

12:15.150 --> 12:17.730
but it's actually like quite a high click-through rate.

12:17.730 --> 12:19.200
When the circle thing,

12:19.200 --> 12:21.720
I think this is showing up in the labels,

12:21.720 --> 12:25.487
like in the specific, you know,

12:25.487 --> 12:29.700
the kind of the Claymation emoji thing.

12:29.700 --> 12:31.500
So that tends to show up there.

12:31.500 --> 12:33.505
So that's an interesting thing to look at.

12:33.505 --> 12:35.670
We also see neck, when we show the neck,

12:35.670 --> 12:36.930
the click rate is pretty high.

12:36.930 --> 12:38.640
Flash photography is good,

12:38.640 --> 12:40.080
sleeve, forehead.

12:40.080 --> 12:43.170
Okay, so that's kind of telling us roughly what's working.

12:43.170 --> 12:44.385
We could also look at what's not working.

12:44.385 --> 12:49.385
So is the pale and we can see the very end.

12:50.580 --> 12:52.410
So these are the things with the lowest click rate.

12:52.410 --> 12:56.160
So when it notices, there's a hairstyle that seems

12:56.160 --> 12:57.453
to perform worse.

12:58.440 --> 13:00.537
When there's a white color in there

13:00.537 --> 13:03.378
that seems to perform worse,

13:03.378 --> 13:05.385
then this electric blue color.

13:05.385 --> 13:08.520
So that's in some of the Claymation ones,

13:08.520 --> 13:09.600
it's performing worse.

13:09.600 --> 13:13.350
So you start to get a sense of what sorts of things

13:13.350 --> 13:14.580
are improving performance

13:14.580 --> 13:18.000
and what sorts of things are decreasing in performance.

13:18.000 --> 13:19.350
And these are just correlations.

13:19.350 --> 13:22.005
So you do need to test these hypotheses,

13:22.005 --> 13:24.185
but this is a great way to find new ideas

13:24.185 --> 13:25.833
of what's a test.

13:27.480 --> 13:29.330
All right, hopefully this was useful.
