ESanchezLozano / Action-Units-Heatmaps

Code for BMVC paper "Joint Action Unit localisation and intensity estimation through heatmap regression"
85 stars 26 forks source link

Heatmap generation #4

Open HassanAbbas92 opened 5 years ago

HassanAbbas92 commented 5 years ago

Hello ESanchezLozano

I'm trying to generate Heatmap for new AU is this a correct way ?

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal

# create a grid of (x,y) coordinates at which to evaluate the kernels
xlim = (0, 63)
ylim = (0, 63)
xres = 64
yres = 64

x = np.linspace(xlim[0], xlim[1], xres)
y = np.linspace(ylim[0], ylim[1], yres)
xx, yy = np.meshgrid(x,y)

x_1 = 10
y_1 = 10

x_2 = 40
y_2 = 40

o_x_1 = 5
o_y_1 = 5
o_x_2 = 5
o_y_2 = 5

A = 1
B = 0.5
f1 = A  *   np.exp( -( (np.power((xx - x_1),2) / (2*o_x_1**2)) + (np.power((yy - y_1),2) / (2*o_y_1**2)) ) )

f2 = B   *  np.exp( -( (np.power((xx - x_2),2) / (2*o_x_2**2)) + (np.power((yy - y_2),2) / (2*o_y_2**2)) ) )

zz = f1 + f2

# reshape and plot image
img = zz.reshape((xres,yres))
plt.imshow(img); plt.show()

image

ESanchezLozano commented 5 years ago

Hi,

They don't look pretty symmetric in the intensity, do they?

Please do use my @ so that I can realise there's a comment over here

Many thanks