@edyumeev

Ошибка invalid syntax как исправить?

from imageai.Detection.Custom import DetectionModelTrainer

trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="dataset")
trainer.setTrainConfig(object_names_array=["dateset"], batch_size=4, num_experiments=200, train_from_pretrained_model="pretrained-yolov3.h5")
trainer.trainModel()

Using TensorFlow backend.
Traceback (most recent call last):

  File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-7-c6f288dcaef9>", line 1, in <module>
    from imageai.Detection.Custom import DetectionModelTrainer

  File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\__init__.py", line 2, in <module>
    from imageai.Detection.keras_retinanet.models.resnet import resnet50_retinanet

  File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 19, in <module>
    import keras

  File "C:\ProgramData\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils

  File "C:\ProgramData\Anaconda3\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
    from . import conv_utils

  File "C:\ProgramData\Anaconda3\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
    from .. import backend as K

  File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\__init__.py", line 89, in <module>
    from .tensorflow_backend import *

  File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf

  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow

  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *

  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 114
    def TFE_ContextOptionsSetAsync(arg1, async):
                                         ^
SyntaxError: invalid syntax


  • Вопрос задан
  • 362 просмотра
Решения вопроса 1
sergey-gornostaev
@sergey-gornostaev Куратор тега Python
Седой и строгий
async - ключевое слово в Python начиная с версии 3.7, а потому не может использовать в качестве имени аргумента.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы