Open omarirfa opened 2 years ago
Which version of python are you running?
I am running the code on python 2.7.17
Can you try python 3.x?
I converted the first step code to work with python 3 (using python 3.9.12) involving step1_ANLS_with_autograd.py along with other related files to extract the KM Primary pigments.
First step output:
Currently doing the second step for conversion, but I am confused by some of these errors since they also came up in the first step. It says: "TypeError: 'float' object cannot be interpreted as an integer"
Float error for reference:
To fix this I have been just converting the code with double slashes where division is happening instead of single but I am unsure if this is the best way to do this?
Another error that came up was also because of how division was done and how it was being read while slicing
Slicing error:
To fix this I have been also just adding double slashes to the required element, again unsure if this would be the best way to handle this?
Lastly, I am on this error atm trying to figure out how broadcasting is being done.
Broadcasting error:
TL;DR: In summary, just wanna ask if I am doing these things right if so, I will continue converting the remaining steps. I have converted step 1 of the code and just want to confirm if the output seems fine. There are three errors that I have seen:
Have you tried the 2to3
tool that comes with Python?
On Jul 3, 2022, at 9:16 PM, Omar Irfan Khan @.***> wrote:
I converted the first step code to work with python 3 (using python 3.9.12) involving step1_ANLS_with_autograd.py along with other related files to extract the KM Primary pigments.
First step output: https://user-images.githubusercontent.com/61637151/177051942-8f2452f5-e7e1-4706-9778-9c673fc476dd.png Currently doing the second step for conversion, but I am confused by some of these errors since they also came up in the first step. It says: "TypeError: 'float' object cannot be interpreted as an integer"
Float error for reference: https://user-images.githubusercontent.com/61637151/177051585-c321a197-de78-4fff-916a-21e5fca251a2.png To fix this I have been just converting the code with double slashes where division is happening instead of single but I am unsure if this is the best way to do this?
Another error that came up was also because of how division was done and how it was being read while slicing
Slicing error: https://user-images.githubusercontent.com/61637151/177051684-5fc805f0-bab1-4a94-aeca-3a4c1d219051.png To fix this I have been also just adding double slashes to the required element, again unsure if this would be the best way to handle this?
Lastly, I am on this error atm trying to figure out how broadcasting is being done.
Broadcasting error: https://user-images.githubusercontent.com/61637151/177052095-9d20fff5-d23a-4cee-9b44-cc8a1cc9130a.png TL;DR: In summary, just wanna ask if I am doing these things right if so, I will continue converting the remaining steps. I have converted step 1 of the code and just want to confirm if the output seems fine. There are three errors that I have seen:
Float error (solved by using double slashes instead of single to convert it basically to an int) Slicing error (solved the same way as float error) Broadcasting error (currently looking into) — Reply to this email directly, view it on GitHub https://github.com/JianchaoTan/Pigmento-PaintingAnalysis/issues/1#issuecomment-1173147486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACC7XRYPN4EHFT3ZZ7NTS3VSHKGFANCNFSM52DSUOWQ. You are receiving this because you were mentioned.
Yup I have tried that but that only converts basic arguments such as the print statement or converting xrange to range from python2 to python3. There are some problems such as the broadcasting problem which I cannot solve atm since numpy requires the shape of the arrays to be the same when doing arithmetic operations on them, and I think in the previous numpy it was not the same?
If I remember correctly, numpy used to let missing dimensions broadcast, so a (2,3) array and a (3,) array were compatible. Later, they started requiring that you explicitly add a dimension to make broadcasting work, e.g., by turning the (3,) array into a (1,3) array. Perhaps this is relevant?
On Jul 13, 2022, at 3:01 PM, Omar Irfan Khan @.***> wrote:
Yup I have tried that but that only converts basic arguments such as the print statement or converting xrange to range from python2 to python3. There are some problems such as the broadcasting problem which I cannot solve atm since numpy requires the shape of the arrays to be the same when doing arithmetic operations on them, and I think in the previous numpy it was not the same?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
Will have to check and get back to u on that. I think it will just be a simple np.reshape (1,-1) operation to obtain that (1,3) array. I will test and see if it works
Sorry for the late reply. Just reshaped one of the arrays, since both cant be reshaped to match using np.reshape. I am getting another error now while indexing regarding broadcasting as well. Any thoughts on if reshaping would be the best approach for 3 dimensional arrays? Idk if I should pad it with empty zeroes or would that distort the data.
Please see the image attached:
Sorry for the late reply. Just reshaped one of the arrays, since both cant be reshaped to match using np.reshape. I am getting another error now while indexing regarding broadcasting as well. Any thoughts on if reshaping would be the best approach for 3 dimensional arrays? Idk if I should pad it with empty zeroes or would that distort the data.
Please see the image attached:
Hi @omarirfa , I am trying to use the code for extracting KM mixing weights and encounter exact the same problem as you had before. I am wondering have you sorted it out?
Hi @iwnlcyan unfortunately, I did not fully solve this error since it kept giving more broadcasting errors in subsequent lines. However, I did find another library that does Pigment stuff I was looking for but its in C++ if that helps you
Heres the link of that library: https://github.com/lindemeier/painty
Hi,
Firstly this is an amazing paper and I wanted to try this repository out. I am running into an error which says "AttributeError: 'TriMesh' object has no attribute '_TriMesh__halfedges' "
I was wondering what is the reason for this. I found the trimesh GitHub after reading the trimesh.py file ( https://github.com/yig/trimesh )
Would love your opinion on this @yig or anyone!
Pic for reference: