Giter Club home page Giter Club logo

pywick's People

Contributors

achaiah avatar cclauss avatar yazgoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pywick's Issues

Implementation of ARiA-2

Hi!

Thanks alot for the inclusion of ARiA in your library! The implementation of ARiA in the library is correct, however I feel for ARiA-2 there were substitution errors which led to an incorrect formula. If you were to substitute and reduce (for speedup) you end up getting the following form: ARiA2(x) = xsigmoid(betax)**alpha which can be implemented as

`
class Aria2(nn.Module):
"""
ARiA2 activation function, a special case of ARiA, for ARiA = f(x, 1, 0, 1, 1, b, 1/a)
"""

def __init__(self, a=1.5, b = 1.):
    super(Aria2, self).__init__()
    self.alpha = a
    self.beta = b

def forward(self, x):
    return x * torch.sigmoid(self.beta*x)**(self.alpha)

`

Problem with PolyConv2d, forward fucntion

Hi, and thanks for your code
I just try to implement this on keras for a learning purpose, but as i do this i cannot understand block_index, so i think you forgot using for loop or how you pass block_index to it:

class PolyConv2d(nn.Module):
    def forward(self, x, block_index):
        x = self.conv(x)
        bn = self.bn_blocks[block_index]
        x = bn(x)
        x = self.relu(x)
        return x

please let me know if I was wrong about this one

BCEDiceFocalLoss problem

In the file, the dice is defined as a BCE loss, which seems to be wrong.
def init(self, l=0.5, weight_of_focal=1.):
super(BCEDiceFocalLoss, self).init()
# self.bce = BCELoss2d()
# self.dice = SoftDiceLoss()
self.dice = BCELoss2d()
self.focal = FocalLoss(l=l)
self.weight_of_focal = weight_of_focal

DUNet Failed to Download.

Hello,

I am trying to run your implementation of DUNet and it fails to initialize the model.

The code I ran was:
`from pywick.models.segmentation import DUNet_Resnet50

img = torch.randn(2, 3, 256, 256)
model = DUNet_Resnet50()
outputs = model(img)
`

which threw this error:

Model file /root/.torch/models/resnet50-25c4b509.pth is not found. Downloading.
Downloading /root/.torch/models/resnet50-25c4b509.zip from https://hangzh.s3.amazonaws.com/encoding/models/resnet50-25c4b509.zip...

RuntimeError Traceback (most recent call last)
in ()
1 img = torch.randn(2, 3, 256, 256)
----> 2 model = DUNet_Resnet50()
3 outputs = model(img)

6 frames
/usr/local/lib/python3.7/dist-packages/pywick/models/segmentation/dunet.py in DUNet_Resnet50(num_classes, **kwargs)
138
139 def DUNet_Resnet50(num_classes=1, **kwargs):
--> 140 return get_dunet(num_classes=num_classes, backbone='resnet50', **kwargs)
141
142

/usr/local/lib/python3.7/dist-packages/pywick/models/segmentation/dunet.py in get_dunet(num_classes, backbone, pretrained, **kwargs)
133 pretrained : bool (default: True) - whether to load pretrained backbone network, that was trained on ImageNet.
134 """
--> 135 model = DUNet(num_classes=num_classes, backbone=backbone, pretrained=pretrained, **kwargs)
136 return model
137

/usr/local/lib/python3.7/dist-packages/pywick/models/segmentation/dunet.py in init(self, num_classes, pretrained, backbone, aux, **kwargs)
26
27 def init(self, num_classes, pretrained=True, backbone='resnet101', aux=False, **kwargs):
---> 28 super(DUNet, self).init(num_classes, pretrained=pretrained, aux=aux, backbone=backbone, **kwargs)
29 self.head = _DUHead(2144, **kwargs)
30 self.dupsample = DUpsampling(256, num_classes, scale_factor=8, **kwargs)

/usr/local/lib/python3.7/dist-packages/pywick/models/segmentation/da_basenets/segbase.py in init(self, num_classes, pretrained, aux, backbone, **kwargs)
21 self.nclass = num_classes
22 if backbone == 'resnet50':
---> 23 self.pretrained = resnet50_v1s(pretrained=pretrained, **kwargs)
24 elif backbone == 'resnet101':
25 self.pretrained = resnet101_v1s(pretrained=pretrained, **kwargs)

/usr/local/lib/python3.7/dist-packages/pywick/models/segmentation/da_basenets/resnetv1b.py in resnet50_v1s(pretrained, model_root, **kwargs)
236 if pretrained:
237 from .model_store import get_resnet_file
--> 238 model.load_state_dict(torch.load(get_resnet_file('resnet50', root=model_root)), strict=False)
239 return model
240

/usr/local/lib/python3.7/dist-packages/pywick/models/segmentation/da_basenets/model_store.py in get_resnet_file(name, root)
49 download(_url_format.format(repo_url=repo_url, file_name=file_name),
50 path=zip_file_path,
---> 51 overwrite=True)
52 with zipfile.ZipFile(zip_file_path) as zf:
53 zf.extractall(root)

/usr/local/lib/python3.7/dist-packages/pywick/models/segmentation/da_basenets/download.py in download(url, path, overwrite, sha1_hash)
66 r = requests.get(url, stream=True)
67 if r.status_code != 200:
---> 68 raise RuntimeError("Failed downloading url %s"%url)
69 total_length = r.headers.get('content-length')
70 with open(fname, 'wb') as f:

RuntimeError: Failed downloading url https://hangzh.s3.amazonaws.com/encoding/models/resnet50-25c4b509.zip

The same happens with other DUNet backbones. I am not sure if other models have similar issues, but it seems to be a simple access problem.

Sample Tutorial

Hi ,

Thank you for creating this wonderful package!

I am having trouble in creating data model pipe line. Could you please create a simple example using say cat/dog data and describe how data pipe line would work using pywick. I think this would be helpful to people who want to quick start with this package.

Thanks

BinaryFocalLoss

The assignment of self.alpha is missing in the constructor.

Can not import Dataset

Traceback (most recent call last):
  File "test_datasets.py", line 3, in <module>
    import pywick.datasets.tnt.dataset as dataset
  File "/data/pywick/pywick/datasets/tnt/dataset.py", line 1, in <module>
    from pywick.datasets.tnt.batchdataset import BatchDataset
  File "/data/pywick/pywick/datasets/tnt/batchdataset.py", line 2, in <module>
    from pywick.datasets.tnt.dataset import Dataset
ImportError: cannot import name 'Dataset'

epsilon = 1e-10

Hello, I don't know why the Focalloss need to add "epsilon = 1e-10".

TRAIN AND VALIDATION LOSS SHOWING NAN

Hello, first of all, I would like to appreciate the work you are doing. I was trying to use the FocalLoss for Multi-Class problem and tried using FocalLoss2. It shows nan values for train and validation loss, and when I keep the gamma to 2, the training fails after one epoch while when gamma = 0(equal to cross_entropy_loss) it is working but still the loss values are nan. Please help me

Custom metric doesn't show up in fit_loader()

I wrote the following custom metric,

class F1Score(pywick.metrics.Metric):
    def __init__(self, micmac='micro'):
        super().__init__()
        self._name = f'f1_{micmac}'
        self.micmac = micmac
        self.correct = []
        self.preds = []

    def reset(self):
        self.correct = []
        self.preds = []

    def __call__(self, inputs, y_pred, y_true, is_val=False):
        self.correct.extend(y_true.detach().to('cpu').numpy().tolist())
        self.preds.extend(y_pred.detach().to('cpu').numpy().argmax(axis=1).tolist())
        f1 = sklearn.metrics.f1_score(self.correct, self.preds, average=self.micmac)
        return f1

and use it like so

metrics = [F1Score('micro'), CategoricalAccuracySingleInput(top_k=1)]
trainer.compile(optimizer='adam',
                criterion='cross_entropy',
                initializers=initializers,
                metrics=metrics)

But while running trainer.fit_loader(...), I get the following output

Epoch 1/1:   7%|โ–‹         | 7/98 [00:12<02:46,  1.83s/ batches, loss=0.6508, top_1:acc=76.04, learn_rates=[0.001]]

No mention of the custom metric anywhere!

But running trainer.eval_loader() gives,

{'val_f1_micro': 0.7514395393474088,
 'val_loss': 0.6613252784975586,
 'val_top_1:acc_metric': 75.14395393474088}

Which works fine, so what's going on with fit_loader()?

Collaboration

Hi there :)

I would like to ping you for a possible collaboration on an open source project, if you are curios, just ping me at [email protected]

Thank you

Have a wonderful day

Francesco

EXCITING

This code base is the most exciting repo I recently find in github!!
Keep on this awesome work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.