Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I convert raw image to hdf5 file? #10

Open
junjunwang2016 opened this issue Dec 24, 2020 · 16 comments
Open

How can I convert raw image to hdf5 file? #10

junjunwang2016 opened this issue Dec 24, 2020 · 16 comments

Comments

@junjunwang2016
Copy link

Hi, can you give convert code?

@yanmengdi123
Copy link

请问你找到转换代码了吗,可以运行自己的数据集了吗

@junjunwang2016
Copy link
Author

junjunwang2016 commented Mar 9, 2021 via email

@yanmengdi123
Copy link

yanmengdi123 commented Mar 9, 2021 via email

@junjunwang2016
Copy link
Author

junjunwang2016 commented Mar 9, 2021 via email

@yanmengdi123
Copy link

是这样的,作者发布的代码我运行了,但是只能运行作者的数据集,无法使用自己的数据集进行测试训练。谢谢您啦。

@junjunwang2016
Copy link
Author

Maybe this code can convert your own dataset for test:
import os
import h5py
import numpy as np
from PIL import Image
import cv2
import scipy.io as io

def write_hdf5(image,groundTruth,outfile):
with h5py.File(outfile,'w') as f:
f['test_img'] = image
f['test_labels'] = groundTruth

image_test = './Mydata/img/'
image_groundTruth = './Mydata/mask/'
dataset_path = './my_hdf5/'

Nimgs = 8
channels = 3
height = 256
weight = 256

def get_datasets(image_test,image_groundTruth):
imgs = []
groundTruth = []
for i in range(1,10):
filename = "1.png"
image_path = os.path.join(image_test, filename)
img = cv2.imread(image_path)
img = cv2.resize(img, (weight, height), interpolation=cv2.INTER_AREA)
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    imgs.append(img)
    
for i in range(1,10):
    groundTruth_name = "1.png"
    gt_path = os.path.join(image_groundTruth, groundTruth_name)
    gt = cv2.imread(image_groundTruth + groundTruth_name)

    gt = cv2.resize(gt,(weight,height),interpolation=cv2.INTER_AREA)
    gt_gray = cv2.cvtColor(gt, cv2.COLOR_RGB2GRAY)
    #gt = Image.fromarray(np.uint8(gt))

    groundTruth.append(gt_gray)
print("img_gray shape:{}".format(np.shape(groundTruth[2])))
cv2.imshow('jl',groundTruth[2])
cv2.imwrite('test.png', groundTruth[2])
#cv2.waitKey()

return imgs, groundTruth

test_image,test_labels= get_datasets(image_test,image_groundTruth)
print('save')
write_hdf5(test_image,test_labels,dataset_path+'my.hdf5')

@yanmengdi123
Copy link

好的,谢谢您。我再研究一下。

@junjunwang2016
Copy link
Author

junjunwang2016 commented Mar 9, 2021 via email

@pankaiqianghub
Copy link

请问一下你们弄的训练集的那个hdf5文件train_data_feat_v2.hdf5是在哪找到的呀 谢谢啦

@170744039
Copy link

请问一下你们弄的训练集的那个hdf5文件train_data_feat_v2.hdf5是在哪找到的呀 谢谢啦

老哥,我也搞不懂这个问题,很烦,可以交流一下吗?我qq2978064409

@170744039
Copy link

是这样的,作者发布的代码我运行了,但是只能运行作者的数据集,无法使用自己的数据集进行测试训练。谢谢您啦。

老哥,我正在复现这个代码,有点复杂,可以请教一下吗?我qq2978064409

@170744039
Copy link

170744039 commented Apr 6, 2022 via email

@170744039
Copy link

170744039 commented Apr 6, 2022 via email

@170744039
Copy link

170744039 commented Apr 6, 2022 via email

@junjunwang2016
Copy link
Author

junjunwang2016 commented Apr 6, 2022 via email

@170744039
Copy link

你研究的是多种篡改还是单一篡改呀

------------------ 原始邮件 ------------------ 发件人: "jawadbappy/forgery_localization_HLED" @.>; 发送时间: 2022年4月6日(星期三) 晚上9:10 @.>; @.@.>; 主题: Re: [jawadbappy/forgery_localization_HLED] How can I convert raw image to hdf5 file? (#10) 哦,老哥哪这个相关代码可以分享一下嘛,我也在研究这个方向的,但是可以复现的开源代码很少?
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年4月6日(星期三) 晚上9:07 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [jawadbappy/forgery_localization_HLED] How can I convert raw image to hdf5 file? (#10) 不好意思,这个代码后来没用了。又从GitHub上找的别的相关代码跑的。
------------------ 原始邮件 ------------------ 发件人: "jawadbappy/forgery_localization_HLED" @.>; 发送时间: 2022年4月6日(星期三) 晚上9:05 @.>; @.@.>; 主题: Re: [jawadbappy/forgery_localization_HLED] How can I convert raw image to hdf5 file? (#10) 是这样的,作者发布的代码我运行了,但是只能运行作者的数据集,无法使用自己的数据集进行测试训练。谢谢您啦。 老哥,我正在复现这个代码,有点复杂,可以请教一下吗?我qq2978064409 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

尊敬的小姐姐,恳请加个好友,我导师压根不懂这个方向却让我开这个课题,整个实验室没人交流很痛苦啊?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants