im2latex icon indicating copy to clipboard operation
im2latex copied to clipboard

state = state[:, :, 0]*0.299 + state[:, :, 1]*0.587 + state[:, :, 2]*0.114 IndexError: index 2 is out of bounds for axis 2 with size 2

Open aspnetcs opened this issue 5 years ago • 5 comments

when I run the following command python train.py --data=configs/data.json --vocab=configs/vocab.json --training=configs/training.json --model=configs/model.json --output=results/full/ the result is Loaded 76322 formulas from data/train.formulas.norm.txt Bucketing the dataset... Traceback (most recent call last): File "train.py", line 61, in main() File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in call return self.main(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "train.py", line 36, in main form_prepro=vocab.form_prepro) File "/home/rootx/me/im2latex-master/model/utils/data_generator.py", line 76, in init self._set_data_generator() File "/home/rootx/me/im2latex-master/model/utils/data_generator.py", line 84, in _set_data_generator self._data_generator = self.bucket(self._bucket_size) File "/home/rootx/me/im2latex-master/model/utils/data_generator.py", line 104, in bucket for idx, (img, formula, img_path, formula_id) in enumerate(self): File "/home/rootx/me/im2latex-master/model/utils/data_generator.py", line 201, in iter result, skip = self._process_instance(example) File "/home/rootx/me/im2latex-master/model/utils/data_generator.py", line 173, in _process_instance img = self._img_prepro(img) File "/home/rootx/me/im2latex-master/model/utils/image.py", line 52, in greyscale state = state[:, :, 0]*0.299 + state[:, :, 1]*0.587 + state[:, :, 2]*0.114 IndexError: index 2 is out of bounds for axis 2 with size 2 root@rootx-virtual-machine:/home/rootx/me/im2latex-master# How to fix it? Thanks a lot !

aspnetcs avatar Jan 13 '19 14:01 aspnetcs

met the same error

jiancgao avatar Apr 30 '20 17:04 jiancgao

Run under GPU environment, do not run under CPU environment

aspnetcs avatar May 01 '20 06:05 aspnetcs

Run under GPU environment, do not run under CPU environment

--

At 2020-05-01 01:22:07, "Jiancong Gao" [email protected] wrote:

met the same error

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

aspnetcs avatar May 01 '20 06:05 aspnetcs

Run under GPU environment, do not run under CPU environment -- At 2020-05-01 01:22:07, "Jiancong Gao" [email protected] wrote: met the same error — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Hi, later I found it is a problem with the input data. I re-ran the program and it worked. Also I modify your work a little bit to try adaptive attention and it worked pretty well. Brilliant code by you. Thanks!

jiancgao avatar May 10 '20 21:05 jiancgao

Would you like to send me your modified code and I will test it. Let's work together to write a paper, publish it, and achieve retrieval by EI or SCI. OK?

--

At 2020-05-11 05:35:27, "Jiancong Gao" [email protected] wrote:

Run under GPU environment, do not run under CPU environment … -- At 2020-05-01 01:22:07, "Jiancong Gao" [email protected] wrote: met the same error — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Hi, later I found it is a problem with the input data. I re-ran the program and it worked. Also I modify your work a little bit to try adaptive attention and it worked pretty well. Brilliant code by you. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

aspnetcs avatar May 15 '20 06:05 aspnetcs