当前位置:网站首页>Use the picture name to label the picture [tips]
Use the picture name to label the picture [tips]
2022-07-28 22:41:00 【It's too simple】
problem
When doing the second classification task , There are two types of pictures in a folder . Originally, two types of pictures are more common in different folders , This situation requires another way of thinking .
solve
Use the picture name to judge , The code snippet is as follows :
import os
path = ' Write the address of the picture folder here '
photos = os.listdir(path)# Put all picture names together, including suffixes
Y = []
for ph in photos:
x = os.path.splitext(ph)[0]# Separate picture names and suffixes , Pick up the name
# The number in the string of the picture name is ( Or use letters isalpha()) Or another way to equal a certain character '{}'.format(x[-1])=='e' To make a judgment
if (x[-1]).isdigit():
Y.append(1)
else:
Y.append(0)边栏推荐
- Container configuration starts redis cluster single machine 6 nodes 3 Master 3 slave
- Winserver operation and maintenance technology stack
- 6K6w5LiA5qyh5pS75Ye75YiG5p6Q
- CMD common commands
- How do we do full link grayscale on the database?
- Qt+ffmpeg environment construction
- [CVPR 2021] cylinder3d: cylindrical asymmetric 3D convolution network for LIDAR point cloud segmentation
- imx6q gpio复用
- [get mobile information] - get mobile information through ADB command
- Sword finger offer II 066. sum of words (medium prefix tree design string)
猜你喜欢

STM32 - reset and clock control (cubemx for clock configuration)

imx6q gpio复用

STM32CUBEIDE(10)----ADC在DMA模式下扫描多个通道

Sword finger offer II 055. Binary search tree iterator (medium binary search tree iterator)

842. 排列数字

Lvs+keepalived high availability deployment practical application

Using PCL to batch display PCD point cloud data flow

How to install WiFi correctly

Use PCL to batch convert point cloud.Bin files to.Pcd

Idea generate class diagram plug-in UML (super detailed)
随机推荐
79. Word search (medium string array matrix backtracking)
JMeter installs third-party plug-ins plugins Manager
771. 字符串中最长的连续出现的字符
容器化配置启动redis集群 单机6节点 3主3从
BOM (location object, navigation object)
C language to realize string reverse order arrangement
Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
elment-plus图标input上面带的图标为什么不显示
Use PCL to batch convert point cloud.Bin files to.Pcd
Solve the problem that TS node xxx.ts executes TS code and reports errors
32. Longest valid bracket (difficult stack string)
Vscode ROS configuration GDB debugging error record
Sword finger offer II 056. Sum of two nodes in a binary search tree (simple binary search tree DFS hash table double pointer iterator)
Paddlenlp is based on ernir3.0 text classification. Take the crime prediction task of cail2018-small dataset as an example [multiple tags]
Command line agent: proxychains configuration
There will be a black line on the border when the button in the wechat applet is clicked
log4j漏洞 elk平台 处理方法 (logstah5.5.1)
776. String shift inclusion problem
fatal error: io. h: No such file or directory
Less than a year after its establishment! MIT derivative quantum computing company completed financing of US $9million