Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RandomSplitter : TypeError: Can't instantiate abstract class WheatParser with abstract methods bboxes, labels #214

Closed
rashmimarganiatgithub opened this issue Jul 24, 2020 · 25 comments
Labels
bug Something isn't working

Comments

@rashmimarganiatgithub
Copy link

Hi Aditya,

RandomSplitter is not able to split the train and validation dataset properly from WheatParser. Could you please correct the format ( def filepath(self, o) -> Union[str, Path]:
return self.source / f"{o.image_id}.jpg"
) code from WheatParser class from https://www.kaggle.com/okeaditya/fastaiv2-pytorch-lightning-fasterrcnn

@rashmimarganiatgithub rashmimarganiatgithub added the bug Something isn't working label Jul 24, 2020
@oke-aditya
Copy link
Contributor

I am Looking into it. cc @lgvaz

@oke-aditya
Copy link
Contributor

I am able to replicate the issue. @lgvaz this was working previously. What is the recent change that we need to adopt ?
Below is the error when running

parser = WheatParser(df, source / "train")

RandomSplitter is working fine.

TypeError: Can't instantiate abstract class WheatParser with abstract methods bboxes, labels

Thanks @rashmimarganiatgithub for the bug !!!

@oke-aditya
Copy link
Contributor

This tutorial is gone way off track. The reason is so much change in the API and our codebase. We would need some changes to make it run https://www.kaggle.com/okeaditya/fastaiv2-pytorch-lightning-fasterrcnn

It might take a while to revamp the kernel to make it work, We need some changes in the model too.
But the wheat parser will be fixed soon.

@oke-aditya
Copy link
Contributor

I have fixed the parser issue @rashmimarganiatgithub . The model might not work coz of a recent update.

@lgvaz
Copy link
Collaborator

lgvaz commented Jul 24, 2020

The modifications to make it work with the new model API are very simple, can you work on that @oke-aditya ?

Also, you can now use COCOMetric =)

@oke-aditya
Copy link
Contributor

oke-aditya commented Jul 24, 2020

Yep. I will fix it up by tomorrow 😀 I was more concerned about parser. But that seems good.
Guess fixing that up will allow us to make use of wheat as an example tutorial. (Again)

@rashmimarganiatgithub
Copy link
Author

Thanks @lgvaz and @oke-aditya for a quick look, waiting for a fix and uprunning kernel to use this library. Please keep me posted only 10 days left to try out your library. Please make it as soon as possible.

@oke-aditya
Copy link
Contributor

oke-aditya commented Jul 25, 2020

@lgvaz looks like that contest is gonna end. I will fix it up and create one for efficient det as well. 😀 @rashmimarganiatgithub I am fixing it. I will tag you here once I create a new version. It will be up before today 👍

@rashmimarganiatgithub
Copy link
Author

@oke-aditya thanks for the quick response. Will it support for all range of efficientnetB0-B7?

@oke-aditya
Copy link
Contributor

Yes We use ross wightman's implementation of efficient Det. https://github.com/rwightman/efficientdet-pytorch
It supports a variety of backbones. Including all efficient net B0-b7. Also pre trained weights on COCO are available are for some.
I have tried in mantisshrimp once. Max I could train was b4 on Kaggle.

@oke-aditya
Copy link
Contributor

Hey, @rashmimarganiatgithub I have fixed up the notebook and Trained a faster rcnn resnet 152 FPN network too. It might help you to get a good score on LB. FRCNN is really good with Resnet 152 FPN. I have tested this and it works. I am attaching notebook here as well in case it doesn't show up in Kaggle. I have updated on Kaggle as well (if it doesn't show up do let me know) Happy Building. Below is a zip with ipynb code.

Fastaiv2+PyTorch Lightning FasterRCNN.zip

With mantis, you can train on Multiple gpus too. So do try that to win up the competition and best luck 👍

@oke-aditya
Copy link
Contributor

I guess we can add that above notebook as advanced guide.

@rashmimarganiatgithub
Copy link
Author

@oke-aditya thanks much. I will now use it for other competition too. Hence I need to understand Randomsplitter. Could you please point me to the codebase.

@rashmimarganiatgithub
Copy link
Author

@oke-aditya thanks for the help

@oke-aditya
Copy link
Contributor

oke-aditya commented Jul 25, 2020

Here is the source code for Randomsplitter. Also all the code is in the mantisshrimp folder .

Feel free to use it and do let us know whenever you build something great / new with this. Just open an Issue for it. Or post in #125 .

Also, you can simply fork my kernel and get started !!!!

@rashmimarganiatgithub
Copy link
Author

@oke-aditya, Sure, I will keep you posted on the same.

@rashmimarganiatgithub
Copy link
Author

@lgvaz @oke-aditya. Closing this issue. thanks for your good work.

@rashmimarganiatgithub
Copy link
Author

@oke-aditya , can you please provide me mantisshrimp git repro code with .whl file. installing a package using online in contest is prohibited. Can you please make it quick.

@oke-aditya
Copy link
Contributor

oke-aditya commented Jul 26, 2020

Ok so I get the problem. I guess in the competition like Kaggle internet is disabled for submission. For that, you won't be able to install mantisshrimp from github.

Since this is built on PyTorch you don't need the entire repo. I Suggest you train a model with mantisshrimp in a training kernel. Save it in Kaggle datasets. Upload the mantisshrimp code in datasets.
In a new Inference, kernel Instantiate the model as you did while training. You need mantisshrimp codebase for that. load_state_dict() using torch to load the weights. And simply do the inference.

You need to sometihng like this kernel. Even it has an external dependency to submit the code.

I am working to get the .whl file. As of now I am providing a zip of source code. Let me know if this works, I will provide wheel too.
mantisshrimp-master.zip

@oke-aditya
Copy link
Contributor

@rashmimarganiatgithub
Copy link
Author

thanks much.

@rashmimarganiatgithub
Copy link
Author

rashmimarganiatgithub commented Jul 26, 2020

@oke-aditya, code is breaking after installing the package here is the error and kernel is shared with you.

Even with !pip install git+git://github.com/lgvaz/mantisshrimp.git command it is breaking


NameError Traceback (most recent call last)
in
----> 1 from mantisshrimp.models.rcnn.faster_rcnn import *
2 from mantisshrimp.models.rcnn import *

/opt/conda/lib/python3.7/site-packages/mantisshrimp/init.py in
----> 1 from mantisshrimp.utils import *
2 from mantisshrimp.core import *
3 from mantisshrimp.parsers import *
4 from mantisshrimp.data import *
5 from mantisshrimp.transforms import *

/opt/conda/lib/python3.7/site-packages/mantisshrimp/utils/init.py in
5 from mantisshrimp.utils.download_utils import *
6 from mantisshrimp.utils.data_dir import *
----> 7 from mantisshrimp.utils.soft_dependencies import *
8 from mantisshrimp.utils.capture_stdout import *

/opt/conda/lib/python3.7/site-packages/mantisshrimp/utils/soft_dependencies.py in
2
3 try:
----> 4 import fastai2.vision.all as fastai
5
6 HAS_FASTAI = True

/opt/conda/lib/python3.7/site-packages/fastai2/vision/all.py in
----> 1 from ..basics import *
2 from ..callback.all import *
3 from .augment import *
4 from .core import *
5 from .data import *

/opt/conda/lib/python3.7/site-packages/fastai2/basics.py in
----> 1 from .data.all import *
2 from .optimizer import *
3 from .callback.core import *
4 from .learner import *
5 from .metrics import

/opt/conda/lib/python3.7/site-packages/fastai2/data/all.py in
----> 1 from ..torch_basics import *
2 from .core import *
3 from .load import *
4 from .external import *
5 from .transforms import *

/opt/conda/lib/python3.7/site-packages/fastai2/torch_basics.py in
3 from .torch_imports import *
4 from .torch_core import *
----> 5 from .layers import *

/opt/conda/lib/python3.7/site-packages/fastai2/layers.py in
271
272 # Cell
--> 273 @log_args
274 class BaseLoss():
275 "Same as loss_cls, but flattens input and target."

NameError: name 'log_args' is not defined

@oke-aditya
Copy link
Contributor

@rashmimarganiatgithub have a look at #222. Let us fix it there. I have commented on one of the solutions and why it isn't working as of now.

@lgvaz
Copy link
Collaborator

lgvaz commented Jul 26, 2020

@rashmimarganiatgithub Can you provide us with a reproducer for the error?

I do not currently understand why you're getting that error, you can maybe provide us with a colab/kaggle notebook that gives the error and then we try to fix it.

@lgvaz
Copy link
Collaborator

lgvaz commented Jul 26, 2020

This is now being tracked at #222

@lgvaz lgvaz closed this as completed Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants