Invalid argument: TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer. Traceback (most recent call last):

Viewed 511

I am getting the above error while training the models I am training it on Google Colab

  1. tensorflow version = 1.15
  2. numpy version = 1.18.0

    !python3 object_detection/model_main.py \ --pipeline_config_path=/content/models/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config \ --model_dir=training/

I am totally new to tensorflow and not sure how to solve it. Can anyone please help me

This is error

Traceback (most recent call last):



 File "/usr/local/lib/python3.6/dist-packages/numpy/core/function_base.py", line 117, in linspace
    num = operator.index(num)

TypeError: 'numpy.float64' object cannot be interpreted as an integer
2 Answers

Providing the solution here (Answer Section), even though it is present in the comments section, for the benefit of the community.

When the user has downgrade numpy version 1.18.0 to 1.17.0 has resolved the problem.

%tensorflow_version 1.x
import tensorflow as tf
print(tf.__version__)
!pip install numpy==1.17.0

find where the linspace command is used in the code, the num variable needs to be passed as an integer. Shown in below answer:

np.linspace(0,1,int(10.))

Downgrading may not be required if one finds where linspace is used.

Related