imageAI实现目标检测(不用opencv)

参见 https://www.jiqizhixin.com/articles/2018-07-02-7,实践过程中碰到运行错误“找不到libcudart.so.11.0 ”
,这样解决,参考 

【tensorflow】缺少libcudart.so.11.0和libcudnn.so.8解决方法

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda

后来又提示“module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'”。

在generic_utils.py中增加2个函数:

def to_snake_case(name):
  intermediate = re.sub('(.)([A-Z][a-z0-9]+)', r'1_2', name)
  insecure = re.sub('([a-z])([A-Z])', r'1_2', intermediate).lower()
  # If the class is private the name starts with "_" which is not secure
  # for creating scopes. We prefix the name with "private" in this case.
  if insecure[0] != '_':
    return insecure
  return 'private' + insecure

def populate_dict_with_module_objects(target_dict, modules, obj_filter):
  for module in modules:
    for name in dir(module):
      obj = getattr(module, name)
      if obj_filter(obj):
        target_dict[name] = obj

但还是报错:“Version:0.9 StartHTML:0000000105 EndHTML:0000000727 StartFragment:0000000141 EndFragment:0000000691

2021-06-17 14:32:39.658178: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (HP-tangjian): /proc/driver/nvidia/version does not exist

估计电脑没有gpu导致这个错误。

别的方式实现目标检测

可以参考 目标检测算法实践

原文地址:https://www.cnblogs.com/tangxiaosheng/p/14893447.html