Comments (8)
你好我想请问一下这个问题你解决了吗
from mimn.
为什么现在数据集文件都不一样了
from mimn.
不是没有读取到文件,是因为有几张图片的大小是1*1,过res50的时候会报错
from mimn.
不是没有读取到文件,是因为有几张图片的大小是1*1,过res50的时候会报错
请问这个问题您解决了嘛?
from mimn.
不是没有读取到文件,是因为有几张图片的大小是1*1,过res50的时候会报错
请问这个问题您解决了嘛?
因为没有其他途径获得完好的数据集,所以将有问题的图片跳过了。
from mimn.
不是没有读取到文件,是因为有几张图片的大小是1*1,过res50的时候会报错
请问这个问题您解决了嘛?
因为没有其他途径获得完好的数据集,所以将有问题的图片跳过了。
请问您有把所有图片的尺寸都改成224*224吗?我发现如果图片的分辨率很高的话也是会报这个错误的
from mimn.
他有些句子没有对应的图片,img这个列表是空的,直接len(img[0])就会报错
from mimn.
他有些句子没有对应的图片,img这个列表是空的,直接len(img[0])就会报错
自己研究了一下,将data_utils.py的read_img这个函数换成如下我重写的函数就行了,原理就是把所有数据都放到GPU上,之前的数据是放在内存上的,不好管理,8G显存3070读取整个数据集无报错。
def read_img(self, imgs_path):
imgs = []
with torch.no_grad():
self.cnn_extractor.to('cuda')
for j in range(len(imgs_path)):
img_path = imgs_path[j].strip().replace('\'', '')
try:
img = Image.open('./datasets/img/' + img_path).convert('RGB')
input = self.transform_img(img).unsqueeze(0).to('cuda')
output = self.cnn_extractor(input).squeeze()
imgs.append(output)
img.close()
except:
error = 1
torch.cuda.empty_cache()
embed_dim_img = len(imgs[0])
#embed_dim_img = 2048
img_features = torch.zeros(self.max_img_len, embed_dim_img)
num_imgs = len(imgs)
if num_imgs >= self.max_img_len:
for i in range(self.max_img_len):
img_features[i,:] = imgs[i]
else:
for i in range(self.max_img_len):
if i < num_imgs:
# img_features[(self.max_img_len-num_imgs)+i,:] = imgs[i]
img_features[i, :] = imgs[i]
else:
break
return img_features, min(self.max_img_len, num_imgs)
from mimn.
Related Issues (9)
- 代码方便公开一下么 HOT 1
- 请问方便公开一下训练集 测试集 验证集的划分吗
- 关于图像特征抽取 HOT 5
- 关于图像特征抽取 HOT 4
- img.zip 数据集解压错误 HOT 2
- 您好,请问这个程序torch和torchvision版本是什么 HOT 1
- 参数过滤问题
- 预处理问题,内存泄露
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mimn.