pycharm如何破解

本文介绍了一个提供PyCharm注册码的网站,通过该网站可以轻松获得PyCharm的有效注册码,避免了寻找注册码的烦恼。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

还在为pycharm到期而苦恼么,还在满世界找pycharm注册码么,打开网址 http://idea.lanyus.com,将注册码复制到pycharm就行了。


这个网址不知道谁做的,这么高调会不会是pycharm自己做的呢,感恩!

C:\Users\hp\PycharmProjects\PythonProject\.venv\Scripts\python.exe "D:\PyCharm 2025.1.1.1\PythonProject\ChineseWrite\chinese_rec.py" 2025-05-31 20:05:14.516144: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. 2025-05-31 20:05:15.196581: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. train Begin training ./data/train/03755 WARNING:tensorflow:From D:\PyCharm 2025.1.1.1\PythonProject\ChineseWrite\chinese_rec.py:19: The name tf.disable_v2_behavior is deprecated. Please use tf.compat.v1.disable_v2_behavior instead. WARNING:tensorflow:From C:\Users\hp\PycharmProjects\PythonProject\.venv\Lib\site-packages\tensorflow\python\compat\v2_compat.py:98: disable_resource_variables (from tensorflow.python.ops.resource_variables_toggle) is deprecated and will be removed in a future version. Instructions for updating: non-resource variables are not supported in the long term Traceback (most recent call last): File "D:\PyCharm 2025.1.1.1\PythonProject\ChineseWrite\chinese_rec.py", line 384, in <module> main(None) # 直接调用主函数 ^^^^^^^^^^ File "D:\PyCharm 2025.1.1.1\PythonProject\ChineseWrite\chinese_rec.py", line 351, in main train() File "D:\PyCharm 2025.1.1.1\PythonProject\ChineseWrite\chinese_rec.py", line 148, in train train_feeder = DataIterator(data_dir='./data/train/') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\PyCharm 2025.1.1.1\PythonProject\ChineseWrite\chinese_rec.py", line 62, in __init__ self.labels = [int(file_name[len(data_dir):].split(os.sep)[0]) for file_name in self.image_names] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '去_9.png'
06-01
### 解决 `ValueError: invalid literal for int() with base 10: '去_9.png'` 错误 在 TensorFlow 数据迭代器的数据预处理过程中,出现 `ValueError: invalid literal for int() with base 10: '去_9.png'` 错误,表明尝试将字符串 `'去_9.png'` 转换为整数时失败。此问题通常发生在数据加载或标签解析阶段[^2]。 #### 错误原因分析 1. **数据格式不匹配**:代码可能期望标签为整数,但实际读取到的是文件名(如 `'去_9.png'`),导致无法转换。 2. **数据预处理不足**:未正确分离文件名和标签,直接将文件名作为标签处理。 3. **路径或命名规则问题**:文件名中包含非数字字符,无法通过 `int()` 函数解析。 #### 解决方案 以下提供一种解决方案,确保文件名与标签正确分离,并避免无效转换。 #### 示例代码 假设文件夹结构如下: ``` data/ 去_9.png 来_5.png ... ``` 其中,文件名中的数字部分表示标签。 ```python import os import tensorflow as tf # 定义数据目录 data_dir = "data/" # 获取所有文件名 file_list = [f for f in os.listdir(data_dir) if f.endswith(".png")] # 提取标签并构建数据集 def extract_label(filename): # 假设文件名为 '文字_标签.png' 格式 label_part = filename.split('_')[-1].split('.')[0] # 提取标签部分 return int(label_part) filenames = [os.path.join(data_dir, f) for f in file_list] labels = [extract_label(f) for f in file_list] # 创建 TensorFlow 数据集 dataset = tf.data.Dataset.from_tensor_slices((filenames, labels)) # 加载图像函数 def load_image(filename, label): image = tf.io.read_file(filename) image = tf.image.decode_png(image, channels=3) image = tf.image.resize(image, [224, 224]) # 调整大小 image = image / 255.0 # 归一化 return image, label # 映射加载函数 dataset = dataset.map(load_image) # 打印示例数据 for image, label in dataset.take(1): print("Image shape:", image.shape) print("Label:", label.numpy()) ``` #### 代码说明 1. **文件名解析**:通过 `filename.split('_')[-1].split('.')[0]` 提取文件名中的标签部分,并将其转换为整数。 2. **数据集构建**:使用 `tf.data.Dataset.from_tensor_slices` 构建数据集,确保文件路径和标签一一对应。 3. **图像加载**:定义 `load_image` 函数,用于加载、解码和预处理图像。 #### 注意事项 - 确保文件命名规则一致,例如 `'文字_标签.png'` 格式。 - 如果标签存储在单独的文件中(如 CSV 文件),需先加载标签数据并与文件名匹配[^2]。 ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值