Fix filter must sum=0
This commit is contained in:
parent
9628b2c17e
commit
febad1f9c3
|
@ -7,4 +7,4 @@ Dataset/
|
|||
.vscode
|
||||
/*/__pycache__
|
||||
.mypy_cache
|
||||
/FilterEvaluator/image*
|
||||
/*/image*
|
||||
|
|
|
@ -71,26 +71,27 @@ traindata, testdata = Loader.Cifar10Mono(batchsize, num_workers=0, shuffle=False
|
|||
|
||||
|
||||
|
||||
for batch_idx, (data, target) in enumerate(traindata):
|
||||
utils.NumpyToImage(data.cpu().detach().numpy(), CurrentPath+"image", title="TrainData")
|
||||
break
|
||||
# for batch_idx, (data, target) in enumerate(traindata):
|
||||
# utils.NumpyToImage(data.cpu().detach().numpy(), CurrentPath+"image", title="TrainData")
|
||||
# break
|
||||
|
||||
weight,active = EvaluatorUnsuper.UnsuperLearnSearchWeight(model, layer, traindata, NumSearch=1,SaveChannel=8,SearchChannelRatio=1, Interation=128)
|
||||
utils.NumpyToImage(weight, CurrentPath+"image",title="SearchWeight")
|
||||
|
||||
b =0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# weight,active = EvaluatorUnsuper.UnsuperLearnSearchWeight(model, layer, traindata, NumSearch=100000, SearchChannelRatio=32, Interation=10)
|
||||
# np.save("WeightSearch.npy", weight)
|
||||
# weight = np.load(CurrentPath+"WeightSearch.npy")
|
||||
# weight, active = EvaluatorUnsuper.UnsuperLearnSearchWeight(
|
||||
# model, layer, traindata, NumSearch=10, SaveChannel=4000, SearchChannelRatio=32, Interation=10)
|
||||
# utils.NumpyToImage(weight, CurrentPath+"image",title="SearchWeight")
|
||||
|
||||
# b =0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
weight,active = EvaluatorUnsuper.UnsuperLearnSearchWeight(model, layer, traindata, NumSearch=100000, SearchChannelRatio=32, Interation=10)
|
||||
np.save("WeightSearch.npy", weight)
|
||||
weight = np.load(CurrentPath+"WeightSearch.npy")
|
||||
utils.NumpyToImage(weight, CurrentPath+"image",title="SearchWeight")
|
||||
# weight = np.load(CurrentPath+"WeightSearch.npy")
|
||||
# bestweight,index = EvaluatorUnsuper.UnsuperLearnFindBestWeight(model,layer,weight,traindata,128,100000)
|
||||
# np.save(CurrentPath+"bestweightSearch.npy", bestweight)
|
||||
|
|
|
@ -53,6 +53,9 @@ def UnsuperLearnSearchWeight(model, layer, dataloader, NumSearch=10000, SaveChan
|
|||
minactive = np.empty((0))
|
||||
minweight = np.empty([0,newweightshape[-3],newweightshape[-2],newweightshape[-1]])
|
||||
newweight = np.random.uniform(-1.0,1.0,newweightshape).astype("float32")
|
||||
newweight = newweight.reshape((-1,newweightshape[-1]*newweightshape[-2]))
|
||||
newweight = np.swapaxes(newweight,0,1)-np.mean(newweight,-1)
|
||||
newweight = np.swapaxes(newweight,0,1).reshape(newweightshape)
|
||||
|
||||
dataset = []
|
||||
for batch_idx, (data, target) in enumerate(dataloader):
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 286 B |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue