Giter VIP home page Giter VIP logo

Comments (1)

bertsky avatar bertsky commented on July 21, 2024

Note: In METS, the labels are a flat sequence of gt:state elements with @prop from the above mentioned schema file, one per page.

   <mets:dmdSec ID="DMDGT_0001">
      <mets:mdWrap MDTYPE="OTHER" OTHERMDTYPE="GT">
         <mets:xmlData>
            <gt:gt>
               <gt:state prop="granularity/physical/document-related/word"/>
               <gt:state prop="granularity/physical/document-related/text-line"/>
               <gt:state prop="granularity/physical/document-related/region"/>
               <gt:state prop="data-attributes/document-related/visual/text/font/multi-font/typefaces"/>
               <gt:state prop="data-attributes/document-related/visual/text/font/multi-font/font-sizes"/>
               <gt:state prop="data-attributes/language/mixed"/>
               <gt:state prop="condition/production-related/document-faults/ink-from-facing"/>
               <gt:state prop="condition/wear/additions/informative/annotations"/>
               <gt:state prop="condition/production-related/document-characteristics/low-contrast"/>
               <gt:state prop="condition/acquisition/method-flaws/imaging/uneven-illumination"/>
            </gt:gt>
         </mets:xmlData>
      </mets:mdWrap>
   </mets:dmdSec>

These are then referenced under each physical structMap's page via @DMDID.

IMO in core we first need some additional API to support that. Like (in analogy to pageId):

OcrdMets.get_gt_labelling(self, for_fileIds=None) # returns dict of file ID to label list
OcrdMets.get_gt_labelling_for_file(self, ocrd_file) # returns label list
OcrdMets.set_gt_labelling_for_file(self, labels, ocrd_file) # takes label list
# but also:
OcrdMets.add_file(self, ... labels=None, ...) # add full label list
OcrdMets.find_files(self, ... labels=None, ...) # filter by label list (match any)

What's your opinion, @kba?

Perhaps – instead of parsing this from the METS, we could also see to it that OCR-D mirrors them in the parsed PAGE-XML, i.e. OcrdPage.

For example as:

  <MetadataItem type="imageProperties" name="gt-labelling">
    <Labels externalModel="https://github.com/OCR-D/gt-labelling/blob/master/xsd_schema/OCR-D_GT_schema.xsd" externalId="http://www.ocr-d.de/GT/">
      <Label value="granularity/physical/document-related/word"/>
      <Label value="granularity/physical/document-related/text-line"/>
      <Label value="granularity/physical/document-related/region"/>
      <Label value="data-attributes/document-related/visual/text/font/multi-font/typefaces"/>
      <Label value="data-attributes/document-related/visual/text/font/multi-font/font-sizes"/>
      <Label value="data-attributes/language/mixed"/>
      <Label value="condition/production-related/document-faults/ink-from-facing"/>
      <Label value="condition/wear/additions/informative/annotations"/>
      <Label value="condition/production-related/document-characteristics/low-contrast"/>
      <Label value="condition/acquisition/method-flaws/imaging/uneven-illumination"/>
    </Labels>
  </MetadataItem>

This would make it easier to access the labels from a processor or PAGE viewer.

from browse-ocrd.

Related Issues (20)

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.