资源简介
将mat文件转换成lmdb文件,用于caffe,python代码
代码片段和文件信息
# -*- coding: utf-8 -*-
“““
Created on Wed Aug 10 20:05:02 2016
@author: dlg
“““
import numpy as np
import h5py
import lmdb
import sys
caffe_root = ‘/home/dlg/Downloads/cuda7.0/caffe/‘
sys.path.insert(0 caffe_root + ‘python‘)
import caffe
import scipy.io as sio
train_data=sio.loadmat(‘/home/dlg/Downloads/cuda7.0/caffe/data/train/osmraster/down_version/train/raster_landuse_all.mat‘)
test_data=sio.loadmat(‘/home/dlg/Downloads/cuda7.0/caffe/data/train/osmraster/down_version/test/berlin_landuse.mat‘)
test_label=sio.loadmat(‘/home/dlg/Downloads/cuda7.0/caffe/data/train/osmraster/down_version/test/berlin_gt.mat‘)
train_label=sio.loadmat(‘/home/dlg/Downloads/cuda7.0/caffe/data/train/osmraster/down_version/train/label_all.mat‘)
train_data_1=train_data[‘raster_all‘]
train_label=train_label[‘label_all‘]
test_data_1=test_data[‘image1‘]
test_label=test_label[‘gt‘]
X=train_data_1
y=train_label
map_size = X.nbytes * 10
print ‘Start generate...‘
env = lmdb.open(‘/home/dlg/Downloads/fcn.berkeleyvision.org-master/shiyan8/trainlmdb1‘ map_size=map_size)
with env.begin(write=True) as txn:
for i in range(X.shape[0]):
print i
- 上一篇:简易版植物大战僵尸 用python写的
- 下一篇:Python端口扫描器
相关资源
- Python端口扫描器
- 简易版植物大战僵尸 用python写的
- python读取wav时频谱绘制
- 计算二面角的python小程序
- 基于python语言的坐标信息转换为shap
- 麦子学院python视频
- jpype1for python3.5
- 历史天气爬虫
- YouMoney有钱记账一个python写的开源的个
- PyYAML-3.12.tar.gz
- 基于opencv2的骨架提取代码 python实现
- json资料(python and c)
- B站用户数据爬取
- python3+Tkinter+GUI界面+pyserial+串口+串口
- Arcgis 基于Python的高斯扩散模型代码
- Python.CLF
- python实现2048游戏
- 大学排名爬虫
- annoy-1.15.2-cp36-cp36m-win_amd64.whl
- python矩阵乘法小程序
- python 音乐播放器
- Python分词系统jieba代码有注释,无报错
- Python生成3D图,饼图,合图,散点图,
- 树莓派目标跟踪代码python
- 简单的Python蚁群算法
- Python爬虫教程千万别错过
- get_wuyou.zip
- python入门到精通某智付费课程超级完
- 用python代码把背景颜色过滤掉
- python所有源代码
评论
共有 条评论