-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image transformers that do not use domain transformations #17
Conversation
Some image transformation methods need the whole image because they do both parameter estimation (=learning) and actual transformation (using learned parameters) in a single operation. Therefore, when transforming, instances are not independent and thus this can not be solved with domain transformation in Orange.
@borondics and @ngergihun, does this solve problems due to chunking? This is the "latter option" from yesterdays email - which I believe is actually the only possible solution for some methods and thus unavoidable. |
Hi @markotoplak ! Do you think, that this approach work for the referencing? |
Yes, this approach would also work for references, with the only addition that the reference would need to get restructured in the same way. |
@ngergihun, so what is the structure that pySNOM expects? If the first (numpys) axis Y or X? |
@markotoplak if I swap the attr_x and attr_y in hypercube, _, indices = get_ndim_hyperspec(
data, (image_opts["attr_y"], image_opts["attr_x"])
) Then it work all fine for me! |
@ngergihun, thanks for the comment, I fixed accordingly and added a comment about it. |
8533073
to
8fb6b53
Compare
@markotoplak in the meanwhile I tried to make the referencing work. Now it is a kind of very simple approach that I reashpe the reference.X to the same shape as the image from the data class SelfRef(PreprocessImageOpts2DOnlyWhole):
def __init__(self, reference):
self.reference = reference.X
def transform_image(self, image):
self.reference = np.reshape(self.reference,np.shape(image))
d = SelfReference(referencedata=self.reference).transform(image)
return d I don't know it is a good approach but for now, it works. Should I make a PR from that version at all? |
@ngergihun, can you open a PR with your modifications? Thanks! What you suggest can't work in a general case. It probably works because the data in the table is ordered in just the right way (which is a tough assumption). The same image reshaping operations as for the data will also have to be executed for the reference. I can do that part. what you can help me with is provide me the data where this works with your current modification, so it will be easier to ensure I did not break anything. |
Yes, I agree, that it is generally a bad solution and only work under very strict circumstances. I open the PR and send some data. |
@markotoplak Another thing came to my mind. So in the new |
@ngergihun, thanks for the comment. I'll add another parameter, |
Some image transformation methods need the whole image because they do both parameter estimation (=learning) and actual transformation (using learned parameters) in a single operation. Therefore, when transforming, instances are not independent and thus this can not be solved with domain transformation in Orange.