DataBlocks API examples

Was about to say, my repo should have a few creative examples we can put on here, let me check real quick :wink:

Off the top of my head:

  • Style Transfer (ImageBlock, ImageBlock): url It’s different because it’s image to image where you do not have a specification for a y as your input is your labelled output

  • Multi-Keypoint regression (ImageBlock, PointBlock): url bringing in a pure dataframe with 17 different keypoints and formatting it in a way the DataBlock API will accept

  • Multi-Label from single label classes (ImageBlock, MultiCategoryBlock) url

  • Binary segmentation + common pitfalls (very specific about segmentation in general, may not fit well) (ImageBlock, SegmentationBlock)url

  • @barnacl already mentioned the age regression so I won’t mention it again :slight_smile:

Okay @barnacl i’m working my way there stop beating me :wink:

8 Likes

Adding to documentation with explanations would be most useful I think.

2 Likes

The age prediction - Image Regression is also a different one from @muellerzr https://github.com/muellerzr/Practical-Deep-Learning-for-Coders-2.0/blob/master/Computer%20Vision/06_Scalar_Regression.ipynb

2 Likes

We can add explanations to CategoryBlock, TransformBlock, ImageBlock etc and also add multiple examples from the excellent work done by @muellerzr already.

1 Like

Right probably we should convert this to a wiki to add examples at top. for example with the Bengali AI we write a one liner like:
Given an image predict 4 different labels( ImageBlock,CategoryBlock,CategoryBlock,CategoryBlock) (link)[https://github.com/muellerzr/Practical-Deep-Learning-for-Coders-2.0/blob/master/Computer%20Vision/06_Multimodal_Head_and_Kaggle.ipynb]
Something like that

2 Likes

@muellerzr can make this a wiki for us :slight_smile:

We’re on the exact same wavelength right now, I don’t know how we managed that

1 Like

Can I? I suppose so, it’s done :wink:

1 Like

haha didn’t meant to (or did i :smiley: ). Just had your AMAZING repo open :slight_smile: (this videolectureusc btw on youtube who was bugging you with questions as usual :rofl: ) Have to checkout the permutation importance stuff

2 Likes

Okay, now that this is a wiki, peeps spread out and get to work and let’s bring back multiple examples haha

I will get to humback whale competition then.

Just edited my above post with the format you asked, for, feel free to copy and paste, I need to get back to that blog homework :wink:

2 Likes

Thanks. See ya later!

One example to get creative minds thinking is a DataBlock example that combines (and needs to combine): get_x, get_y, and get_items. Just FFT, I’ll return to this later if there’s questions :wink:

FYI, simply passing in TransformBlock() used to be how to do regression, but now we have RegressionBlock() :wink: (thag could be a good example of whats different between the base class (TransformBlock) and the RegressionBlock

It’s come to my attention that the ImageBlock is no longer available under TransformBlock. Is it being renamed or deleted accidentally?

It is available under vision.data

1 Like

I had problem to from fastai2.vision.all import *. I found the Git issue below.

And then, I looked up in PyTorch forum and applied both pip install six --upgrade and conda install -c anaconda six commends (of course, one at a time). But, the import error persists. Any one can help me? My fastcore is version 1.17.14 and I also upgaded fastai2.

Edit: Eventually, I rebuilt the environment. Then, I could run the import statement properly. Please let me know what is the better way to do it. Thanks in advance.

HI @muellerzr . I am trying to use multi label from single label classes where the labels simply come from the parent folder name. I reused what you have created in the notebook above:

DataBlock(
blocks = (ImageBlock,MultiCategoryBlock),
get_items = get_image_files,
splitter = RandomSplitter(valid_pct =0.3,seed= 42),
get_y = Pipeline([parent_label,multi_l]),
item_tfms = RandomResizedCrop(224,min_scale=0.3),
batch_tfms = aug_transforms(mult=2))

But I am getting the error

TypeError: ‘<’ not supported between instances of ‘int’ and ‘L’

Any pointers to what I am doing wrong?

Hi
Is there an example related to multiple input - multiple output, where the input would be image and its metadata. The images in question is DICOM and I’m having difficulty in figuring out how to go about it.

Added more details here: Medical Imaging | DataBlock for DICOM metadata

Hi,
What datablock structure would be suitable for an input image and target being variable number of points. I am looking at detecting defects in a finished product. There can be zero or any number of defects. Will PointBlock be suitable for this purpose?

1 Like