To handle more complex dependencies between surgical tools across different frames, the proposed HMM-stabilized deep learning approach can be extended by incorporating higher-order Markov models. By allowing interactions between tools in adjacent frames, the model can capture more intricate relationships and dependencies among surgical tools. This extension would involve updating the transition probabilities in the HMM to consider interactions between multiple tools simultaneously. Additionally, the emission probabilities can be modified to account for the joint presence of multiple tools in a frame, enabling the model to capture complex tool interactions effectively.