Giter VIP home page Giter VIP logo

Comments (3)

jaroslaw243 avatar jaroslaw243 commented on September 25, 2024 1

Yes, because that yaml file contains path to image and init_contour file for that image. You can use it like that too:

import argparse


parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="yaml file with GameTheoreticFramework object", required=True)
parser.add_argument("-in", "--image_name", help="name of the ph2 image (eg. IMD002)",
                    required=True)
parser.add_argument("-pb", "--path_beginning", help="beginning of the image path, added to each path",
                    required=True)
args = parser.parse_args()

with open(args.input) as file:
    gt_segmentation = yaml.load(file, Loader=yaml.Loader)

img_n = args.image_name
path_beg = args.path_beginning

gt_segmentation.image_path = path_beg + r'/%s/%s_Dermoscopic_Image/%s.bmp' % (img_n, img_n, img_n)
gt_segmentation.init_contours = path_beg + r'/init_lesion/%s_lesion.png' % (img_n)

In above example you can use single yaml file for multiple images. You pass an command line argument with some image name, that is used to construct paths to the image itself and to file file with init_contours, then whatever paths were saved in the yaml file get overwritten with this new paths.

This is how an file with init_contours can look like:
IMD002_lesion

It works with any extension supported by openCV function imread
(https://docs.opencv.org/3.4/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56).

from gt_im_s.

jaroslaw243 avatar jaroslaw243 commented on September 25, 2024
  1. I made some changes in the game_theoretic_framework class so it works as a library and added an script with example of such usage.
    If you want an image to be stored as a numpy array then set full_init to True when creating the yaml file. I don't recommend it though, because storing images in a yaml file is inefficient.
    Colour images need to be converted to grayscale (it's done automatically when using load_image), because with that kind of images in mind whole algorithm was developed.

Example output:
example_output

Yaml file used to acquire that output mask:

!!python/object:game_theoretic_framework.GameTheoreticFramework
b_cost_interlaced: null
clique_size: 4
contours: null
differential_evolution_bounds_width: 0.55
expected_val_in: 1
expected_val_out: 0
image: null
image_gradient: null
image_path: .\obrazki_do_testow\IMD004\IMD004_Dermoscopic_Image\IMD004.bmp
img_gradient_ksize: 27
init_b_cost_interlaced: null
init_contours: .\obrazki_do_testow\IMD004\IMD004_lesion\IMD004_lesion.bmp
init_fourier_coeffs_first_part: null
init_fourier_coeffs_second_part: null
init_img_seg: null
init_tr: null
iter_num: 0
max_iterations: 3
object_brighter_than_background: false
order_of_fourier_coeffs: 14
p2c_acc: 2000
prior_b_cost: 0
region_segmentation: null
scaling_const_alpha: 0.1
scaling_const_beta: 0.1
sm_const: 14
  1. In utils there is function hair_removal that removes hair from given image.

from gt_im_s.

franpog859 avatar franpog859 commented on September 25, 2024

Ok, so for multiple images I need to create a yaml file similar to this one and an init_contours image for each one of them? How such an image should look like, @jaroslaw243 ?

Does it work for other extensions than *.bmp?

from gt_im_s.

Related Issues (1)

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.