logo
Browse Source

add requirements

Signed-off-by: gexy5 <xinyu.ge@zilliz.com>
main
gexy5 3 years ago
parent
commit
eae89d7397
  1. 3
      requirements.txt
  2. BIN
      result1.png
  3. BIN
      result2.png
  4. 2
      uniformer.py

3
requirements.txt

@ -0,0 +1,3 @@
towhee
torch
towhee.models

BIN
result1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 69 KiB

BIN
result2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 100 KiB

2
uniformer.py

@ -120,9 +120,9 @@ class Uniformer(NNOperator):
inputs = data.to(self.device)[None, ...] inputs = data.to(self.device)[None, ...]
feats = self.model.forward_features(inputs) feats = self.model.forward_features(inputs)
feats = feats.flatten(2).mean(-1)
features = feats.to('cpu').squeeze(0).detach().numpy() features = feats.to('cpu').squeeze(0).detach().numpy()
feats = feats.flatten(2).mean(-1)
outs = self.model.head(feats) outs = self.model.head(feats)
post_act = torch.nn.Softmax(dim=1) post_act = torch.nn.Softmax(dim=1)
preds = post_act(outs) preds = post_act(outs)

Loading…
Cancel
Save