Git Product home page Git Product logo

aod-net's People

Contributors

boyiliee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aod-net's Issues

Backprapogation Algorithm

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

issue with training AOD-Net

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

below is my solver.prototxt content

net:"Training.prototxt"
base_lr: 0.001
lr_policy: "fixed"
display: 20
max_iter: 150000
momentum: 0.9
weight_decay: 0.0001
snapshot: 15000
snapshot_prefix: "models/model"
solver_mode: GPU
type: "SGD"

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"
}}

My train script

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/'

Network Training parameters for input Image data

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()

if name == 'main':
train()

snapshot of output

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

How to show PSNR and SSIM?

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!

the training parameter about clip

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]

Relu as last layer?

Hi,
Thanks for your code and paper! But I have several questions after looking at your code.

  1. Why do u choose Relu layer as the last layer since Relu is not bounded for producing the image?
  2. In your paper, the b is the constant bias with the default value 1, may I know why you choose b as 1? Combing with the first question, you add 1 and then apply Relu layer, am I correct?

Thanks in advance!

An error occured in code running

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!

pytorch部分代码好像不完整

from utils import logger, weight_init
from config import get_config
from data import HazeDataset

这几个代码好像没有提供 运行出错 请问是什么原因呢

Training AOD-NET

@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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.