Possible to detect divergences on financial datasets?

Hey!

I’m a software engineer working in finance, and as a tech enthusiast, I’ve been really interested in computer vision and what is possible now with Roboflow/Supervision. I came across your platform through the awesome @skalskip92 on X.

I think I might have a cool use case for Roboflow and wanted to get your thoughts on whether it’s feasible. Basically, I’m looking to detect divergences between two datasets visualized as stacked line charts.

For example: Both datasets hit a local top, but then they diverge:

Dataset A forms a higher high while Dataset B forms a lower high. That’s a bullish divergence. I’ve tried building this programmatically without CV, but it misses a lot of cases that are obvious to the trained eye. I’m wondering if fine-tuning a model with Roboflow (maybe using object detection or segmentation) could complement or replace my current setup. To be clear I’d like for Roboflow to be able to detect these.

I added one example below to visually explain what I want to accomplish. Does this sound like something Roboflow could handle? Any tips on getting started, like which model to fine-tune or what would be the key part in getting this working well?

Thanks in advance for any advice!

As a general rule, if you can see it you can teach a computer to see it. Definitely tricky though as my guess is when you see these you are dismissing certain data points that are intertwined with the divergence and you are dismissing other valleys/peaks that appear to be a smaller divergence but don’t count as one.

That being said, here’s how I would start:

  • LOTS of images. Maybe 50 would get you going, but hundreds or thousands will likely be needed to allow the model to parse this
  • Accurate annotations - include everything in the bounding box that is needed, but not a smidge more
  • Include null images. Have some charts in there where NO divergence happens. Maybe 5 or 10% of the total.
  • Active learning. As the model works it will get things wrong. You’ll want to capture those, put them in the dataset and annotate, and then retrain the model. (If you’re using Workflows the block called “Roboflow Dataset Upload” will be useful.)
1 Like

Hi @Sam1!
First off, welcome to the Roboflow community! Thanks for reaching out, and awesome that @skalskip92 pointed you our way! Love seeing finance + CV use cases.

Excellent breakdown from @Automatez! One additional important note, ensure your production images match your training data exactly in terms of visual appearance. Same axis scales, same panel proportions, and same element sizes. Any variation in these will hurt model performance.

As far as model selection goes, I recommend starting with an RF-DETR Medium model. Additionally, please see this link to our documentation on how to first annotate images for object detection models, then generate a dataset version, then train a model, and finally implement the model in a workflow.

Happy building!!

2 Likes

Thanks for this! Really appreciate it.

If you look at my reference photo. Would you go with images that have several annotations like my example, or one annotation per image?

For context, if this is successful I will attempt to use this to detect recent divergences, not historical ones. So detection should be focused on data at the far right of the images I feed the learned model.

Thank you so much, noted! Really appreciated.

You definitely do not want to ONLY annotate one item per image if other legit divergences exist in that image. So you’d have to find charts with only one single example on them. Which can be tough. But also does not gain you anything really - it’s totally fine to have multiple predictions per image and annotate each one.

As for finding trends at the right, generally the models are searching for patterns and it is not built by default to realize that you only want “divergence on the right side of the image”. You would be better off detecting all of them and then you could do a ton of things from there - manually just look at the ones to the right or to automate find the coordinates of each detection and pick the “biggest x value” that indicates it is the detection farthest to the right. Or if all charts are the same, include any detections to the right of a certain point. You can even identify a “zone” and only take actions with detections that fall in that zone.

1 Like

Understood - thanks for that, helps a ton! It’s my first venture into CV, so understanding how to best prepare training data is very useful! Will report back here on my results in a few days.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.