dhlab-epfl / dhSegment

Generic framework for historical document processing
https://dhlab-epfl.github.com/dhSegment
GNU General Public License v3.0
372 stars 116 forks source link

new user looking for examples of multilabel classification #38

Open calebjacksonhoward opened 5 years ago

calebjacksonhoward commented 5 years ago

I have a body of images which I want to segment into seven classes using the utils.PredictionType.MULTILABEL modality for predicting class memberships. I believe that I can do this based on the Use Cases presented in the docs. The only example I have found of dhSegment in use is the demo in the docs, however, which is using the simpler utils.PredictionType.CLASSIFICATON modality.

I would love to look at any and all examples of dhSegment being used in any modality, and in particular in the MULTILABEL modality.

Any and all pointers and assistance will be greatly appreciated.

From googling around, it feels like the user base is somewhat rarified. I hope to add my own application to those testing and applying dhSegment.

Thank you!

monuminu commented 5 years ago

I am also looking at the same . I want to predict various page segments like Tables , Header , Paragraph , Charts etc . Can you please share some example or pretrained model which we can use .

solivr commented 5 years ago

Sorry, we are indeed lacking examples for the MULTILABEL training and I do not have time to publish some at the moment... The main difference in the MULTILABEL training is the data preparation (there are a few hints on how to prepare your data here), the training itself is almost the same. This may get you started but feel free to ask if you have other questions

Ghada-el-fekih commented 4 years ago

I have prepared data for Multilabel classification, and i kept the same training code. So, i am looking for a way to test the obtained model to verify if its working. Can you please help with some hints and examples which we can use .

Thank you!

Ghada-el-fekih commented 4 years ago

I have a body of images which I want to segment into seven classes using the utils.PredictionType.MULTILABEL modality for predicting class memberships. I believe that I can do this based on the Use Cases presented in the docs. The only example I have found of dhSegment in use is the demo in the docs, however, which is using the simpler utils.PredictionType.CLASSIFICATON modality.

I would love to look at any and all examples of dhSegment being used in any modality, and in particular in the MULTILABEL modality.

Any and all pointers and assistance will be greatly appreciated.

From googling around, it feels like the user base is somewhat rarified. I hope to add my own application to those testing and applying dhSegment.

Thank you!

Hey, i'm working on the same task MULTILABEL classification, so i'm wondering if i have to retrain the models VGG16 and Resnet_v1_50 or should i work with the pretrained model ?

tralfamadude commented 4 years ago

I am also attempting the multilabel case. I defined an attribute "type" and have 20 variations. None of them overlap in the areas I defined using VGG. The output of via.create_masks() is pretty complex and leaves a big gap to bridge before training.

I generate classes.txt, picking unique RGB colors from a static list for each label/annotation type.

via.create_masks() created 1 or more mask images (png files) in the label dir. The mask images it makes are white on black where white is the labeled area.

I created a script to combine the black and white masks into a color mask.

tralfamadude commented 4 years ago

I have 20 annotation types for my work at Internet Archive to dissect images of journals, like { cover, footer, header, page_num, references, body, begin_article, ad, editorial, contributors...}. When trying to train, I got this error:

InvalidArgumentError (see above for traceback): Only indices.shape[-1] values between 1 and 7 are currently supported. Requested rank: 20 [[node Label2Img/GatherNd (defined at /home/peb/ws/dhSegment/dh_segment/utils/labels.py:67) ]]

The error arises at: tf.gather_nd(c, tf.cast(class_label_tensor, tf.int32))

Is the multilabel case is limited to 7 maximum? It looks like it depends on tensorflow graph. If so, that should be documented. I have to redo my annotations now.

The reason for having 20 annotation types is that other guidance in the issues here suggests that labeling things you do not want to extract is a good practice.

Rami6786 commented 3 years ago

Sorry, we are indeed lacking examples for the MULTILABEL training and I do not have time to publish some at the moment... The main difference in the MULTILABEL training is the data preparation (there are a few hints on how to prepare your data here), the training itself is almost the same. This may get you started but feel free to ask if you have other questions

@solivr Kindly provide manual for multiabel training, it will be very useful.