OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to Overlay Labeled Coordinates from JSON into JPG Images for CNN Training?

  • Thread starter Thread starter Diogo Rezende
  • Start date Start date
D

Diogo Rezende

Guest
I am working on a computer vision project that involves detecting and segmenting fractures in MRI scans. As part of this project, I have specialists labeling the fractured areas directly on the images. This process generates a JSON file containing the following information:

  • Coordinates of the labeled region
  • The name given to the labeled region
  • The name of the image that was labeled

The challenge I am facing is transferring these coordinates from the JSON file onto the corresponding JPG images to prepare them for CNN training.

Here is an example of the structure of my JSON file:

Code:
"item": {
    "name": "img-00003-00082.jpg",
    "team": {
        "name": "Mask",
        "slug": "mask"
    "file_name": "img-00003-00082.jpg",
"annotations": [
    {
      "bounding_box": {
        "h": 142.16649999999993,
        "w": 124.14549999999997,
        "x": 679.8006,
        "y": 425.7789
      },
      "name": "Broken",
      "polygon": {
        "paths": [
          [
            {
              "x": 695.1519,
              "y": 567.9454
            },
            {
              "x": 679.8006,
              "y": 530.5683
            },

So far, I have managed to extract the necessary coordinates from the JSON file. However, I am struggling to overlay these coordinates onto the JPG image to generate the training data for the CNN.

My questions:

  • How can I accurately overlay the coordinates from the JSON file onto the corresponding JPG images?
  • Are there any recommended libraries or methods specifically suited for this task in Python?
<p>I am working on a computer vision project that involves detecting and segmenting fractures in MRI scans. As part of this project, I have specialists labeling the fractured areas directly on the images. This process generates a JSON file containing the following information:</p>
<ul>
<li>Coordinates of the labeled region</li>
<li>The name given to the labeled region</li>
<li>The name of the image that was labeled</li>
</ul>
<p>The challenge I am facing is transferring these coordinates from the JSON file onto the corresponding JPG images to prepare them for CNN training.</p>
<p>Here is an example of the structure of my JSON file:</p>
<pre><code>"item": {
"name": "img-00003-00082.jpg",
"team": {
"name": "Mask",
"slug": "mask"
"file_name": "img-00003-00082.jpg",
"annotations": [
{
"bounding_box": {
"h": 142.16649999999993,
"w": 124.14549999999997,
"x": 679.8006,
"y": 425.7789
},
"name": "Broken",
"polygon": {
"paths": [
[
{
"x": 695.1519,
"y": 567.9454
},
{
"x": 679.8006,
"y": 530.5683
},

</code></pre>
<p>So far, I have managed to extract the necessary coordinates from the JSON file. However, I am struggling to overlay these coordinates onto the JPG image to generate the training data for the CNN.</p>
<p>My questions:</p>
<ul>
<li>How can I accurately overlay the coordinates from the JSON file onto the corresponding JPG images?</li>
<li>Are there any recommended libraries or methods specifically suited for this task in Python?</li>
</ul>
 

Latest posts

Top