Click here to Skip to main content
15,112,667 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I'm trying to train a code but it gives me this error and I don't know how to solve it!
****EPOCH 0****
Traceback (most recent call last):
  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\client\session.py", line 1292, in _do_call
    return fn(*args)
  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\client\session.py", line 1277, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\client\session.py", line 1367, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.UnknownError: IndexError: index 319979 is out of bounds for axis 0 with size 47722
Traceback (most recent call last):

  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\ops\script_ops.py", line 206, in __call__
    ret = func(*args)

  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 418, in generator_py_func
    values = next(generator_state.get_iterator(iterator_id))

  File "main_S3DIS.py", line 123, in spatially_regular_gen
    center_point = points[point_ind, :].reshape(1, -1)

IndexError: index 319979 is out of bounds for axis 0 with size 47722


         [[{{node PyFunc}} = PyFunc[Tin=[DT_INT64], Tout=[DT_FLOAT, DT_FLOAT, DT_INT32, DT_INT32, DT_INT32], token="pyfunc_1"](arg0)]]
         [[{{node IteratorGetNext}} = IteratorGetNext[output_shapes=[[?,?,3], [?,?,3], [?,?,3], [?,?,3], [?,?,3], ..., <unknown>, [?,?,6], [?,?], [?,?], [?,?]], output_types=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_INT32, DT_FLOAT, DT_INT32, DT_INT32, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](IteratorV2)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main_S3DIS.py", line 239, in <module>
    model.train(dataset)
  File "E:\Research\Codes\Randlanet\RandLANet.py", line 160, in train
    _, _, summary, l_out, probs, labels, acc = self.sess.run(ops, {self.is_training: True})
  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\client\session.py", line 887, in run
    run_metadata_ptr)
  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\client\session.py", line 1110, in _run
    feed_dict_tensor, options, run_metadata)
  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\client\session.py", line 1286, in _do_run
    run_metadata)
  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\client\session.py", line 1308, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.UnknownError: IndexError: index 319979 is out of bounds for axis 0 with size 47722
Traceback (most recent call last):

  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\ops\script_ops.py", line 206, in __call__
    ret = func(*args)

  File "C:\Users\youss\miniconda3\envs\randlanet1\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 418, in generator_py_func
    values = next(generator_state.get_iterator(iterator_id))

  File "main_S3DIS.py", line 123, in spatially_regular_gen
    center_point = points[point_ind, :].reshape(1, -1)

IndexError: index 319979 is out of bounds for axis 0 with size 47722


         [[{{node PyFunc}} = PyFunc[Tin=[DT_INT64], Tout=[DT_FLOAT, DT_FLOAT, DT_INT32, DT_INT32, DT_INT32], token="pyfunc_1"](arg0)]]
         [[{{node IteratorGetNext}} = IteratorGetNext[output_shapes=[[?,?,3], [?,?,3], [?,?,3], [?,?,3], [?,?,3], ..., <unknown>, [?,?,6], [?,?], [?,?], [?,?]], output_types=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_INT32, DT_FLOAT, DT_INT32, DT_INT32, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](IteratorV2)]]


What I have tried:

I haven't tried as I don't know the source of the error
Posted
Updated 15-Oct-21 1:00am

Read the error message:
  File "main_S3DIS.py", line 123, in spatially_regular_gen
    center_point = points[point_ind, :].reshape(1, -1)

IndexError: index 319979 is out of bounds for axis 0 with size 47722

Your index value is way too big.

We can't solve that for you: we can't run your code (if we had it, which we don't) with your data (which we also don't have) and your user inputs (which we have no idea about) - and you need all of that to work out what is causing the problem.

So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. Start here: pdb — The Python Debugger — Python 3.10.0 documentation[^]

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
   
The key is the message that states:
IndexError: index 319979 is out of bounds for axis 0 with size 47722

So you need to follow the tracebacks to find where that value comes from. Once you can get close to the point in your own code, use the debugger to step through the code and examine all the variables to find the one that causes the error.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900