verne.freenode.net changed the topic of #mlpack to: http://www.mlpack.org/ -- We don't respond instantly... but we will respond. Give it a few minutes. Or hours. -- Channel logs: http://www.mlpack.org/irc/
tsathoggua has joined #mlpack
Mathnerd314 has quit [Ping timeout: 244 seconds]
tsathoggua has quit [Quit: Konversation terminated!]
nilay has joined #mlpack
nilay has quit [Ping timeout: 250 seconds]
Mathnerd314 has joined #mlpack
nilay has joined #mlpack
< nilay> zoq: i am having problem in understanding numpy.dot
< nilay> this is because numpy and arma seem to store arrays as different
< nilay> a (4,4,3) array in numpy is four, (4 * 3) matrices
< nilay> and in arma it is three, (4 * 4) matrices
< nilay> so the code i have written for this line: xyz = N.dot(src, rgb2xyz_mat) , in the RGB2LUV function is being incorrect
< nilay> and i am unable to fix it, having spent quite a lot of time on this.
Mathnerd314 has quit [Ping timeout: 252 seconds]
< zoq> numpy is row major and armadillo is column major, so everytime numpy iterates over the rows you iterate over the columns
< zoq> another solution is to transpose the matrix, so you could do src.t() or arma::trans(src).
< zoq> Does, this solve the problem?
< nilay> src is a 3d matrix
< nilay> a cube
< zoq> and I guess rgb2xyz_mat is a 2d martix?
< nilay> yes
< zoq> and the output of xyz is a 2d matrix?
< nilay> 3d matrix
< zoq> okay, so what you do is to iterate over the slices of src: xyz.slice(i) = src.slice(i) * rgb2xyz_mat?
< nilay> no
< nilay> src.slice(i) is of dimension (img.rows, img.cols)
< nilay> rgb2xyz_mat is of dimension (3, 3)
< zoq> and img.rows is the actual image size?
< nilay> yes
< zoq> hm, sounds weird, I need to take a look
< nilay> documentation of numpy.dot says: For N dimensions it is a sum product over the last axis of a and the second-to-last of b. so i tried writing this using loops, but then also i can't get correct answer
< nilay> if we are doing numpy.dot(a, b)
< zoq> okay, so what this does is to transform the rgb values into the CIE 1931 XYZ values.
< zoq> So, you multiply the rgb values with the transformation matrix. Right now I can only think of a naive implementation.
< zoq> should be double b = src.slice(2)(i);
< nilay> is this ( double b = src.slice(2)(i) ) syntax correct?
< nilay> ok it should be vector
< zoq> hm, not sure, I thought it would work? It should return a double
< nilay> src.slice() is a matrix
< nilay> since src is a cube
< nilay> so matrix(i) should be vec?
< zoq> yes, but we like to get the element of that matrix at position i
< nilay> ok let me try.
< nilay> zoq: syntax is correct
< nilay> but the test is failing
< zoq> can you post the outut and the reference output?
< nilay> seems like the problem is numpy and arma array storage. i'll post it in a minute
< nilay> this is our rgb2luv function: http://pastebin.com/s0yxyq92
< zoq> how does the test input look like?
< zoq> I mean the mlpack test input
< nilay> you can run the test it'll print the input given and desired output and that test fails
< zoq> okay, I'll take a look at the code, it might take some time, I need to finish some other things first
< nilay> ok
< zoq> src = N.array([[[0.2, 0.1, 0.2], [0.1, 0.0, 0.1], [0.0, 0.1, 0.2]], [[0.2, 0.1, 0.2], [0.1, 0.0, 0.1], [0.0, 0.1, 0.2]],[[0.2, 0.1, 0.2], [0.1, 0.0, 0.1], [0.0, 0.1, 0.2]]], dtype = N.float64)
< zoq> So it turns out the function interprets the input as RGB, RGB, RGB ...
< zoq> I thought the RGB value at (0, 0) would be (0.2, 0.2, 0.2) and not (0.2, 0.1, 0.2)
< zoq> so, I guess, what you could do here is to adapt the input accordingly
< zoq> also, I think I messed up the xyz matrix, it should be:
< zoq> xyz.slice(0)(i) = 0.430574 * r + 0.341550 * g + 0.178325 * b;
< zoq> xyz.slice(1)(i) = 0.222015 * r + 0.706655 * g + 0.071330 * b;
< zoq> xyz.slice(2)(i) = 0.020183 * r + 0.129553 * g + 0.939180 * b;
tsathoggua has joined #mlpack
tsathoggua has quit [Client Quit]
nilay has quit [Ping timeout: 250 seconds]
Mathnerd314 has joined #mlpack