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

need help #272

Open
tuteming opened this issue Jun 18, 2021 · 6 comments
Open

need help #272

tuteming opened this issue Jun 18, 2021 · 6 comments

Comments

@tuteming
Copy link

by
https://pjreddie.github.io/uwnet/slides/13#3
this is a classifier config
however, by
https://pjreddie.github.io/uwnet/slides/13#11
that is a Discriminator config

I write as follows:
[net]
batch=4
subdivisions=1
height=256
width=256
channels=3

momentum=0.9
decay=0.0001
learning_rate=0.0001
max_batches = 8000
policy=steps
steps=6400,7200
scales=0.1,0.1

#1
[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky

#2
[maxpool]
size=2
stride=2

#3
[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky

#4
[maxpool]
size=2
stride=2

#5
[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky

#6
[maxpool]
size=2
stride=2

#7
[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky

#8
[maxpool]
size=2
stride=2

#9
[avgpool]

[connected]
output=2
activation=linear

[logistic]

//end
///////////////////
In the last layers, what I miss?
please correct it for me. Very thanks!

note: the last [logistic] layer is not in AlexeyAB but has in pjreddie.
I have add [logistic] layer to AlexeyAB version.

@WongKinYiu
Copy link
Owner

maybe add:

[cost]
sse

information is not sufficient to solve the problem. what is your command? what is the error? how you add logistic layer? ...

@tuteming
Copy link
Author

首先謝謝你的快速回覆 上面的鏈結是pjreddie說明GAN的投影片(可用-> or <- 移動來看)
在pix2pix 中 他用的鑑別器在第2個鏈結(第1個鏈結則是一個簡單的分類器)給你對應參考.
logistic層在AlexeyAB version沒有,必須由pjreddie version拷貝,加在相關的地方.
pix2pix源自於pjreddie version darknet/examples/lsd.c 中,不過這版本不全

https://github.com/vaiv/OpenANPR/blob/master/distribute/src/lsd.c 比較完整
對應的東西也是由這裡的src加在AlexeyAB version相關的地方,而不是由pjreddie version.

第2個鏈結鑑別器其實是一個binary classifier,最後2層[connected]與logistic
logistic is binary cross-entropy, softmax is then cross-entropy .
生成器我用的是modify Unet (單獨用確認無誤),鑑別器最後2層我寫得有問題,所以loss=0. 導致生成器loss收斂的有問題
所以想請你幫忙看看.最後2層該怎麼設定, 真是麻煩你了. 謝謝

@tuteming
Copy link
Author

鑑別器用binary classifier and binary cross-entropy 的目的
根據pjreddie的投影片說明:鑑別生成影像的好壞, 來修正生成器. (見第2個鏈結左邊說明)

@WongKinYiu
Copy link
Owner

WongKinYiu commented Jun 18, 2021

您好

請問您的訓練指令是什麼, 遇到的錯誤是什麼, 在pireddie與AlexeyAB中加入新layer的方式並不一樣, 您是怎麼加入logistic layer的.
此外, 程式在pireddie運行順暢嗎.

@tuteming
Copy link
Author

程式在pireddie運行順暢嗎?
run on AlexeyAB win 10.運行順暢 But Alos=0.

怎麼加入logistic layer的

  1. in darknet.h
    add:
    typedef enum {
    ...
    LOGXENT,
    ...
    } LAYER_TYPE;

  2. in parser.c
    add:
    #include "logistic_layer.h"

add:
LAYER_TYPE string_to_layer_type(char * type)
{
...
if (strcmp(type, "[logistic]")==0) return LOGXENT;//why LOGXENT see logistic_layer.c
...
}

add:
layer parse_logistic(list *options, size_params params)
{
layer l = make_logistic_layer(params.batch, params.inputs);
l.h = l.out_h = params.h;
l.w = l.out_w = params.w;
l.c = l.out_c = params.c;
return l;
}

in line 144x
add:
}else if(lt == LOGXENT){
l = parse_local(options, params);

from P-version
copy logistic_layer.c and logistic_layer.h
to A-version
but
line 57 copy_gpu->copy_ongpu
line 58 activate_array_gpu->activate_array_ongpu
line 68 axpy_gpu->axpy_ongpu

訓練指令:ref lsd.c
darknet.exe lsd_1 train2 data/data.txt cfg/gnet.cfg cfg/anet.cfg -clear

@WongKinYiu
Copy link
Owner

AlexeyAB darknet 沒有 lsd.c. 相關的資訊量實在太少了, 無法釐清問題.

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

2 participants