Skip to content

Commit

Permalink
submit
Browse files Browse the repository at this point in the history
  • Loading branch information
yyang181 committed Mar 21, 2023
0 parents commit bf93c18
Show file tree
Hide file tree
Showing 687 changed files with 72,735 additions and 0 deletions.
14 changes: 14 additions & 0 deletions BiSTNet-NTIRE2023/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
data
sample_videos
runs
checkpoints
*.mp4
*.pyc
tmp
tmp_train
tmp_test
tmp_seg
log
result
pretrain
mmediting
21 changes: 21 additions & 0 deletions BiSTNet-NTIRE2023/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 zhangmozhe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
114 changes: 114 additions & 0 deletions BiSTNet-NTIRE2023/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: bistnet
channels:
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2023.01.10=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.38=h1181459_1
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1t=h7f8727e_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- sqlite=3.40.1=h5082296_0
- tk=8.6.12=h1ccaba5_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.2.10=h5eee18b_1
- zlib=1.2.13=h5eee18b_0
- pip:
- absl-py==1.0.0
- addict==2.4.0
- av==8.0.3
- cachetools==4.2.4
- charset-normalizer==2.0.12
- click==8.0.4
- colorama==0.4.5
- commonmark==0.9.1
- cycler==0.11.0
- dataclasses==0.8
- decorator==4.4.2
- easydict==1.9
- einops==0.4.1
- facexlib==0.2.5
- filterpy==1.4.5
- future==0.18.2
- google-auth==2.6.0
- google-auth-oauthlib==0.4.6
- grpcio==1.44.0
- idna==3.3
- imageio==2.15.0
- imageio-ffmpeg==0.4.7
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- joblib==1.1.1
- kiwisolver==1.3.1
- llvmlite==0.36.0
- lmdb==1.3.0
- logger==1.4
- lpips==0.1.4
- markdown==3.3.6
- matplotlib==3.3.4
- mmcv-full==1.7.1
- model-index==0.1.11
- moviepy==1.0.3
- msgpack==1.0.4
- networkx==2.5.1
- numba==0.53.1
- numpy==1.19.5
- oauthlib==3.2.0
- opencv-contrib-python==4.5.3.56
- openmim==0.3.6
- ordered-set==4.0.2
- packaging==21.3
- pandas==1.1.5
- pillow==8.4.0
- pip==21.3.1
- prefetch-generator==1.0.1
- proglog==0.1.10
- protobuf==3.19.4
- pyarrow==6.0.1
- pyasn1==0.4.8
- pyasn1-modules==0.2.8
- pygments==2.14.0
- pyparsing==3.0.7
- pypng==0.0.21
- python-dateutil==2.8.2
- python-graphviz==0.19.1
- pytz==2022.1
- pywavelets==1.1.1
- pyyaml==6.0
- requests==2.27.1
- requests-oauthlib==1.3.1
- rich==12.6.0
- rsa==4.8
- scikit-image==0.17.2
- scikit-learn==0.24.2
- scipy==1.5.4
- setuptools==59.6.0
- six==1.16.0
- sklearn==0.0.post1
- tabulate==0.8.10
- tensorboard==2.8.0
- tensorboard-data-server==0.6.1
- tensorboard-plugin-wit==1.8.1
- threadpoolctl==3.1.0
- tifffile==2020.9.3
- timm==0.6.7
- torch==1.10.0+cu113
- torchaudio==0.10.0+cu113
- torchcontrib==0.0.2
- torchvision==0.11.1+cu113
- tqdm==4.63.0
- typing-extensions==4.1.1
- urllib3==1.26.8
- werkzeug==2.0.3
- wget==3.2
- yacs==0.1.8
- yapf==0.32.0
- zipp==3.6.0
prefix: /data2/yangyixin/anaconda3/envs/bistnet
3 changes: 3 additions & 0 deletions BiSTNet-NTIRE2023/lib/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.formatting.provider": "yapf"
}
65 changes: 65 additions & 0 deletions BiSTNet-NTIRE2023/lib/FeatVGG.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import torch.nn as nn
import utils.vgg_util as vgg_util
from torchvision import models


def conv_to_relu(layer_names):
out_layernames = []
for name in layer_names:
if name.startswith("conv"):
out_layernames.append("relu" + name[4:])
else:
out_layernames.append(name)
return out_layernames


class FeatVGG(nn.Module):
def __init__(self, content_layers=["relu3_1"]):
super(FeatVGG, self).__init__()
self.content_layers = conv_to_relu(content_layers)
self.vgg19 = vgg_util.get_renamed_vgg()
self.last_c_layer = self.content_layers[-1]
is_last_content = False
replace_layers, del_layers = [], []
for name, mod in self.vgg19.named_children():
if is_last_content:
del_layers.append(name)
else:
if name == self.last_c_layer:
is_last_content = True

for name in del_layers:
delattr(self.vgg19, name)

# no need for gradweight vgg19
for param in self.vgg19.parameters():
param.requires_grad = False

def forward(self, input_img):
# input image is BGR image
# each channel ranges in [0,255]
# should be normalized with mean = [0.406*255, 0.456*255, 0.485*255] = [103,116,123]
# out = {}
return self.vgg19(input_img)


class VGGNet_multilayer(nn.Module):
def __init__(self):
"""Select conv1_1 ~ conv5_1 activation maps."""
super(VGGNet_multilayer, self).__init__()
self.select = ["0", "5", "10", "19", "28"]
self.vgg = models.vgg19(pretrained=True).features

def forward(self, x):
"""Extract multiple convolutional feature maps.
x: rgb image
ranges in [0,1]
should be normalzied with mean = [0.485, 0.456, 0.406]
and variance = [0.229, 0.224, 0.225]
"""
features = []
for name, layer in self.vgg._modules.items():
x = layer(x)
if name in self.select:
features.append(x)
return features
Loading

0 comments on commit bf93c18

Please sign in to comment.