Skip to content

Commit

Permalink
add requirements, gitignore and remove pyc
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian-Robert Stöter committed Jan 15, 2018
1 parent 6957ac4 commit 4ccefee
Show file tree
Hide file tree
Showing 29 changed files with 134 additions and 7 deletions.
95 changes: 95 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#### joe made this: http://goel.io/joe

.env/

#####=== OSX ===#####


#####=== Python ===#####

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

#### joe made this: http://goel.io/joe

#####=== OSX ===#####
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
Expand Down
Empty file added __init__.py
Empty file.
Binary file removed data/__init__.pyc
Binary file not shown.
Binary file removed data/base_data_loader.pyc
Binary file not shown.
Binary file removed data/custom_dataset_data_loader.pyc
Binary file not shown.
Binary file removed data/data_loader.pyc
Binary file not shown.
Binary file removed data/dataset/__init__.pyc
Binary file not shown.
Binary file removed data/dataset/base_dataset.pyc
Binary file not shown.
Binary file removed data/dataset/jnd_dataset.pyc
Binary file not shown.
Binary file removed data/dataset/judgement_dataset.pyc
Binary file not shown.
Binary file removed data/dataset/twoafc_dataset.pyc
Binary file not shown.
Binary file removed data/image_folder.pyc
Binary file not shown.
Binary file removed models/__init__.pyc
Binary file not shown.
Binary file removed models/base_model.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions models/dist_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def initialize(self, model='net-lin', net='squeeze', colorspace='Lab', use_gpu=T
self.model = model
self.net = net
self.use_gpu = use_gpu

print(use_gpu)
self.model_name = '%s [%s]'%(model,net)
if(self.model == 'net-lin'): # pretrained net + linear layer
self.net = networks.PNetLin(use_gpu=use_gpu,pnet_type=net,use_dropout=True)
self.net.load_state_dict(torch.load('./weights/%s.pth'%net))
self.net.load_state_dict(torch.load('./weights/%s.pth'%net, map_location=lambda storage, loc: 'cpu'))
elif(self.model=='net'): # pretrained network
self.net = networks.PNet(use_gpu=use_gpu,pnet_type=net)
self.is_fake_net = True
Expand Down Expand Up @@ -100,7 +100,7 @@ def score_2afc_dataset(data_loader,func):
OUTPUTS
[0] - 2AFC score in [0,1], fraction of time func agrees with human evaluators
[1] - dictionary with following elements
d0s,d1s - N arrays containing distances between reference patch to perturbed patches
d0s,d1s - N arrays containing distances between reference patch to perturbed patches
gts - N array in [0,1], preferred patch selected by human evaluators
(closer to "0" for left patch p0, "1" for right patch p1,
"0.6" means 60pct people preferred right patch, 40pct preferred left)
Expand Down
Binary file removed models/dist_model.pyc
Binary file not shown.
Binary file removed models/models.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions models/networks_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from util import util
from skimage import color
from IPython import embed
import pretrained_networks as pn
from . import pretrained_networks as pn

# Off-the-shelf deep network
class PNet(nn.Module):
Expand Down Expand Up @@ -194,7 +194,7 @@ def forward(self, in0, in1):
value = torch.mean(torch.mean(torch.mean((in0-in1)**2,dim=1).view(N,1,X,Y),dim=2).view(N,1,1,Y),dim=3).view(N)
return value
elif(self.colorspace=='Lab'):
value = util.l2(util.tensor2np(util.tensor2tensorlab(in0.data,to_norm=False)),
value = util.l2(util.tensor2np(util.tensor2tensorlab(in0.data,to_norm=False)),
util.tensor2np(util.tensor2tensorlab(in1.data,to_norm=False)), range=100.).astype('float')
ret_var = Variable( torch.Tensor((value,) ) )
if(self.use_gpu):
Expand All @@ -209,7 +209,7 @@ def forward(self, in0, in1):
if(self.colorspace=='RGB'):
value = util.dssim(1.*util.tensor2im(in0.data), 1.*util.tensor2im(in1.data), range=255.).astype('float')
elif(self.colorspace=='Lab'):
value = util.dssim(util.tensor2np(util.tensor2tensorlab(in0.data,to_norm=False)),
value = util.dssim(util.tensor2np(util.tensor2tensorlab(in0.data,to_norm=False)),
util.tensor2np(util.tensor2tensorlab(in1.data,to_norm=False)), range=100.).astype('float')
ret_var = Variable( torch.Tensor((value,) ) )
if(self.use_gpu):
Expand Down
Binary file removed models/networks_basic.pyc
Binary file not shown.
Binary file removed models/pretrained_networks.pyc
Binary file not shown.
Binary file removed models/siam_model.pyc
Binary file not shown.
32 changes: 32 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
appnope==0.1.0
cycler==0.10.0
decorator==4.2.1
ipython==6.2.1
ipython-genutils==0.2.0
jedi==0.11.1
matplotlib==2.1.1
networkx==2.0
numpy==1.14.0
opencv-python==3.4.0.12
parso==0.1.1
pexpect==4.3.1
pickleshare==0.7.4
Pillow==5.0.0
progressbar2==3.34.3
prompt-toolkit==1.0.15
ptyprocess==0.5.2
Pygments==2.2.0
pyparsing==2.2.0
python-dateutil==2.6.1
python-utils==2.2.0
pytz==2017.3
PyWavelets==0.5.2
PyYAML==3.12
scikit-image==0.13.1
scipy==1.0.0
simplegeneric==0.8.1
six==1.11.0
torch==0.3.0.post4
torchvision==0.2.0
traitlets==4.3.2
wcwidth==0.1.7
2 changes: 1 addition & 1 deletion test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Linearly calibrated models
# model.initialize(model='net-lin',net='squeeze',use_gpu=True)
model.initialize(model='net-lin',net='alex',use_gpu=True)
model.initialize(model='net-lin',net='alex',use_gpu=False)
# model.initialize(model='net-lin',net='vgg',use_gpu=True)

# Off-the-shelf uncalibrated networks
Expand Down
Binary file removed util/__init__.pyc
Binary file not shown.
Binary file removed util/__pycache__/__init__.cpython-34.pyc
Binary file not shown.
Binary file removed util/__pycache__/util.cpython-34.pyc
Binary file not shown.
Binary file removed util/html.pyc
Binary file not shown.
Binary file removed util/util.pyc
Binary file not shown.
Binary file removed util/visualizer.pyc
Binary file not shown.

0 comments on commit 4ccefee

Please sign in to comment.