You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TensorFlow图像分类教程图像计数异常及CUDA警告问题求助

Hey there! Let's work through your two issues step by step:

1. Image Count Mismatch (492 instead of 3670)

This is most likely caused by incomplete dataset files or incorrect path configuration. Try these fixes:

  • Verify your dataset is fully downloaded: The official tutorial uses the flower_photos dataset, which has 5 subfolders (daisy, dandelion, roses, sunflowers, tulips) with a total of 3670 images. Check if all subfolders are present and have the correct number of images (e.g., daisy should have 633 images, dandelion 898). If any are missing, re-download and extract the dataset properly.
  • Double-check your data_dir path: Make sure data_dir points to the root folder of flower_photos, not a subfolder. For example, if you accidentally set data_dir to ./flower_photos/daisy, it will only count images in that single subfolder. Print the path to confirm:
    print(data_dir)
    
  • Match all image file extensions: Some images might use uppercase extensions like .JPG or .JPEG which aren't captured by *.jpg. Modify your glob pattern to cover all variations:
    image_count = len(list(data_dir.glob('*/*.[jJ][pP][gG]')))
    # Or use a more flexible pattern:
    # image_count = len(list(data_dir.glob('*/*.jp*g')))
    
2. CUDA Dynamic Library Warning

Don't worry about this warning—it's completely harmless if you don't have an NVIDIA GPU set up:

  • The message tells you that TensorFlow couldn't find the CUDA runtime library (cudart64_110.dll), which is required for GPU acceleration. Since you don't have a GPU configured, TensorFlow will automatically fall back to using your CPU, and your code will run normally.
  • If you do have an NVIDIA GPU and want to enable GPU acceleration, you'll need to install the correct version of CUDA Toolkit (11.0) and matching cuDNN library for your TensorFlow version. After installation, add the CUDA bin directory to your system's PATH environment variable.

内容的提问来源于stack exchange,提问作者SRT

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 09:02:36