boyiliee / aod-net Goto Github PK
View Code? Open in Web Editor NEWAOD-Net (Pytorch & Caffe)
AOD-Net (Pytorch & Caffe)
Hi @Boyiliee ,
Can you please tell what backprapogation algo. you used for gradient calculation
I went through your paper but did not find any mention of backprapogation algo./function which you
used for training your AOD model although other training parameters such as learning rate, momentum, weight decay etc... are mentioned
Hi @Boyiliee
while training AOD-Net with NYU2 database "Loss is not converging"
I prepared train script but during training loss is not converging
I am training network with NYU2 database with 27, 256 as mentioned in your paper
I have used your test_template.prototxt as training.prototxt and I am training network with 150000 iteration ~ ((27,567/batchsize=8)*40 epoch)
as Euclidean loss layer is used in prototxt loss is not converging over the period it remain same around 15000 to 16000
upon training completion I even checked for inference with trained model_iter_150000.caffemodel instead of your AOD_Net.caffemodel but it is producing completely white image as output instead of giving dehazed image
Training.prototxt is same as test_template.prototxt with below modification
input_dim: 1 -----> input_dim: {batchSize} for data/label layer
and for each conv layer i included weight_filler in convolution_param
weight_filler {{
type: "gaussian"
}}
import os
import numpy as np
from pylab import *
import re
import random
import cv2
print cv2.version
import ntpath
ntpath.basename('a/b/c')
def path_leaf(path):
head, tail = ntpath.split(path)
return tail or ntpath.basename(head)
Train_DIR = '../data/AODtrain/training/'
Label_DIR = '../data/AODtrain/original/'
height = 480
width = 640
batch = 8 # batch size
import sys
sys.path.append("/home/ubuntu/Tools/caffe/python/")
import caffe
def EditFcnProto(templateFile, height, width, batch_size):
with open(templateFile, 'r') as ft:
template = ft.read()
# print templateFile
outFile = 'Training.prototxt'
with open(outFile, 'w') as fd:
fd.write(template.format(height=height,width=width,batchSize=batch_size))
def createBatch(img_dir, label_dir, batch_size):
batchdata = []
labelbatchdata = []
for i in range(batch_size):
fname = random.choice(os.listdir(img_dir))
imagepath = Train_DIR + fname
# print fname
# print imagepath
labelpath = label_dir + fname.split('')[0] + '' + fname.split('_')[1] + '.jpg'
# print labelpath
npstore = caffe.io.load_image(imagepath)
labelstore = caffe.io.load_image(labelpath)
data = npstore
data = data.transpose((2, 0, 1))
batchdata.append(data)
label = labelstore
label = label.transpose((2, 0, 1))
labelbatchdata.append(label)
return batchdata, labelbatchdata
def train():
caffe.set_mode_gpu()
caffe.set_device(0)
# training.prototxt is same as test_template.prototxt with only modification for data/label layer is
# input_dim: 1 -----> input_dim: {batchSize}
templateFile = 'train_template.prototxt'
EditFcnProto(templateFile, height, width, batch)
solver = caffe.SGDSolver('solver.prototxt')
# solver = caffe.get_solver('solver.prototxt')
niter = 150000
train_loss = np.zeros(niter)
f = open('loss.txt', 'w')
for it in range(niter):
batchdata, labelbatchdata = createBatch(Train_DIR, Label_DIR, batch)
solver.net.blobs['data'].data[...] = batchdata;
solver.net.blobs['label'].data[...] = labelbatchdata;
solver.step(1)
train_loss[it] = solver.net.blobs['loss'].data
f.write('{0: d} '.format(it))
f.write('{0: f}\n'.format(train_loss[it]))
f.close()
I0530 15:41:02.473088 2152 sgd_solver.cpp:112] Iteration 51940, lr = 0.001
I0530 15:41:07.138154 2152 solver.cpp:239] Iteration 51960 (4.28732 iter/s, 4.66492s/20 iters), loss = 157563
I0530 15:41:07.138191 2152 solver.cpp:258] Train net output #0: loss = 157563 (* 1 = 157563 loss)
I0530 15:41:07.138197 2152 sgd_solver.cpp:112] Iteration 51960, lr = 0.001
I0530 15:41:11.762470 2152 solver.cpp:239] Iteration 51980 (4.32514 iter/s, 4.62412s/20 iters), loss = 156092
I am confused what is going wrong here loss is not converging, please tell me what I am doing wrong and suggest how to proceed
basically I am trying to reproduce your paper for learning
Thanks
I can't find the test dataset in the authors' website.Can you provide the test dataset and the code of PSNR and SSIM?Thank you very much!
I used AOD-Net to train and test the cityscapes_foggy dataset that including 500 training set, when I train 2epoch, the loss about 0.001. The results is not good.
Can you give me some advice to train the model in the dataset. thanks.
the dataset Link: http://people.ee.ethz.ch/~csakarid/SFSU_synthetic/
hello :
I am very glad to see your public your model, I have already seen your paper, there is a question to ask you, you mentioned in the paper “It is also found helpful to clip the gradient to constrain the
norm within [−0.1, 0.1] ”.It means the solve parameter which called "clip_gradient" is among [-0.1,0.1]
What is the model size and no. of Parameters of the trained AOD model?
Hi,
Thanks for your code and paper! But I have several questions after looking at your code.
Thanks in advance!
When I tried to run the file test.py
, an error occured as folows:
Traceback (most recent call last):
File "test/test.py", line 78, in <module>
main();
File "test/test.py", line 74, in main
test()
File "test/test.py", line 58, in test
net.blobs['data'].data[...] = batchdata;
ValueError: could not broadcast input array from shape (3,540,360) into shape (3,600,400)
It seemed that the error was caused by the transpose operation in test
data = data.transpose((2, 0, 1))
and the dimension of the image was somehow not adaptive to the code.
But I changed the line 43 in test
npstore = caffe.io.load_image('data/img/%s.jpg'% imagename)
to
npstore = caffe.io.load_image('data/img/gugong.jpg')
The code ran normally. I want to know what led to the error mentioned above. Thank you!
from utils import logger, weight_init
from config import get_config
from data import HazeDataset
这几个代码好像没有提供 运行出错 请问是什么原因呢
@Boyiliee Thanks for sharing your work publicly I went through your paper and wanted to reproduce it ....I want to to train AOD-NET with my own data
I am new to caffe I can see test.py script but there is no train.py can you please help me on how to train AOD-NET, I will really appreciate your help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.