Comments (1)
Hi. Maybe too late but I have an answer for you.
In demo.py you can see the definition of the spoof_model:
if args.spf_model.endswith('pth.tar'):
if not args.config:
raise ValueError('You should pass config file to work with a Pytorch model')
config = utils.read_py_config(args.config)
spoof_model = utils.build_model(config, args, strict=True, mode='eval')
spoof_model = TorchCNN(spoof_model, args.spf_model, config, device=device)
else:
assert args.spf_model.endswith('.xml')
spoof_model = VectorCNN(args.spf_model)
and in demo_tools/wrapers.py
class TorchCNN:
...
def preprocessing(self, images):
''' making image preprocessing for pytorch pipeline '''
mean = np.array(object=self.config.img_norm_cfg.mean).reshape((3,1,1))
std = np.array(object=self.config.img_norm_cfg.std).reshape((3,1,1))
height, width = list(self.config.resize.values())
preprocessed_imges = []
for img in images:
img = cv.resize(img, (height, width) , interpolation=cv.INTER_CUBIC)
img = cv.cvtColor(img, cv.COLOR_BGR2RGB)
img = np.transpose(img, (2, 0, 1)).astype(np.float32)
img = img/255
img = (img - mean)/std
preprocessed_imges.append(img)
return torch.tensor(preprocessed_imges, dtype=torch.float32)
def forward(self, batch):
batch = self.preprocessing(batch)
self.model.eval()
model1 = (self.model.module
if self.config.data_parallel.use_parallel
else self.model)
with torch.no_grad():
output = model1.forward_to_onnx(batch)
return output.detach().numpy()
So, at least for .pth.tar models, here you can see normalization.
from light-weight-face-anti-spoofing.
Related Issues (20)
- training as multi-classification task, the result was poor.
- how to solve this problem? HOT 1
- how to use LCC_FASD dataset without cropping?
- openvino version
- No such file or directory: './logs/MobileNet3.pth.tar'
- When I run the code, I have a problem like this, can you help me?
- casia cefa train test labels HOT 1
- How to use resnet50 or other models to train the dataset? Thank you. HOT 2
- Running inference of trained model
- Model Classifies all brown or dark people as spoof HOT 1
- Can't run bash init_venv.sh HOT 1
- The confidence score HOT 1
- AttributeError: 'openvino.inference_engine.ie_api.IECore' object has no attribute 'read_network'
- Low accuracy on lcc-fasd
- Convert pytorch module to openvino HOT 1
- image net weights HOT 1
- problem with face detector HOT 1
- hello i am getting error below HOT 1
- transfer learning step?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from light-weight-face-anti-spoofing.