# Layoutlmv2 for classifying sequence of pages

**URL:** <https://discuss.huggingface.co/t/layoutlmv2-for-classifying-sequence-of-pages/24699>\
**Category:** Models\
**Created:** [October 20, 2022, 1:01am UTC](https://discuss.huggingface.co/t/layoutlmv2-for-classifying-sequence-of-pages/24699 "2022-10-20T01:01:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TaraM](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@TaraM](https://discuss.huggingface.co/u/TaraM)\
**Post date:** [October 20, 2022, 1:01am UTC](https://discuss.huggingface.co/t/layoutlmv2-for-classifying-sequence-of-pages/24699/1 "2022-10-20T01:01:21Z")

</div>

Hi,

I have been using LayoutLMv2 for classifying pages of a document as either “First page”, “Middle page”, and “Last page”. I have fine-tuned the model with examples, however the performance is suboptimal.  
As it is now, each page gets a prediction independent from surrounding pages, however the predictions should truly depend on each other. I was thinking of adding another classifiers after LayoutLM to incorporate this dependency. I came across bilstm-crf models for NER and think it might be relevant for my case. Any suggestions if I am on the right track and how to implement?
