Comments (8)
@onceone, The ABC
inheritance ensures that this class cannot be instantiated directly if it has any abstract methods, but currently it doesn't have any. It is an indication that, AnomalibDataset
is the base class, and cannot be used itself.
We could abstractmethod
for the methods that we want to force subclasses to override specific methods.
In which part of the implementation do you think abstractmethod
is missing?
from anomalib.
The methods in AnomalibDataset
aren't very abstract buit very concrete actually. They aren't even implemented in most child classes, so abstract methods wouldn't make sense.
I don't know why the choice was made, to make AnomalibDataset
an abstract base class. Maybe there was a time when the child classes needed to implement methods.
EDIT: ah @samet-akcay already gave the answer..
from anomalib.
Since there are no abstract methods, AnomalibDataset
can be instantiated(as follows code), so why do we still need to inherit ABC?
from abc import ABC,abstractmethod
class Animal(ABC):
# @abstractmethod
def eat(self):
print('eassst')
@property
def name(self):
return 'Animal'
a = Animal()
a.eat()
from anomalib.
I don't exactly remember the main motivation, but I think we wanted to emphasise that AnomalibDataset
cannot be used on its own yet since it is still missing __getitem__
method to be implemented.
@djdameln, can you comment on this?
from anomalib.
In previous versions of the library, AnomalibDataset
had the abstract method _setup
which had to be implemented in the subclasses to assign the samples dataframe. In v1.0.0 we stepped away from this design and assign the dataframe in the constructor. So you are right that it is technically no longer necessary to inherit from ABC. On the other hand, as @samet-akcay pointed out, the AnomalibDataset
is not meant to be instantiated directly, and defining it as a base class could emphasise this.
from anomalib.
I think I got it . Thank you. By the way, do you have any recommendations for books on software design? Thanks again
from anomalib.
There are quite a bit of them, but I could list some here.
- Design patterns : elements of reusable object-oriented software
- Head First Design Patterns, 2E: Building Extensible and Maintainable Object-Oriented Software
- Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems
- Refactoring: Improving the Design of Existing Code
from anomalib.
Thanks
from anomalib.
Related Issues (20)
- [Task]: The documentation for the config file is missing. HOT 3
- [Bug]: Unable to initialize AnomalibMlflowLogger inside engine.from_config HOT 5
- [Task]: Apply anomaly detection on a single folder of Images for segmentation with no labels for supporting labelling HOT 1
- [Bug]: Installation Error: Invalid requirement: 'torch>=2+cu121' HOT 2
- [Bug]: EfficientAd training via API slower than via CLI HOT 16
- [Task]: Add OpenVINO Inference + Performance computation to Engine methods HOT 2
- [Bug]: Colab notebook anomalib install -v doesn't work HOT 4
- [Task]: Training using anomalib train HOT 3
- [Task]: How to perform data enhancement in custom datasets HOT 1
- [Bug]: Setting the threshold using ManualThreshold seems to have no effect on the output of predict HOT 3
- Is the imagenet data set necessary for efficientAd training? HOT 2
- [Bug]: engine.test plots the anomalies in heatmap in wrong place when a cutout transform is used HOT 2
- [Bug]: Cannot install anomalib inside docker HOT 1
- [Bug]: mask layer is not being converted correctly in the 103_folder.ipynb example?
- [Bug]: top-level linter settings are deprecated in favour of their counterparts in the `lint` section.
- [Bug]: Checkpoint loading fails when model doesn't use normalization
- [Bug]: Transformations behaviour possibly not expected when predicting with fresh dataloader HOT 1
- Feature: Dataclass-based Input/Output in Anomalib
- Feature: Multi-GPU Support in Anomalib
- [Bug]: ModuleNotFoundError: No module named 'FrEIA'
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 anomalib.