All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.djl.modality.cv.output.Joints Maven / Gradle / Ivy

/*
 * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
 * with the License. A copy of the License is located at
 *
 * http://aws.amazon.com/apache2.0/
 *
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
 * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package ai.djl.modality.cv.output;

import ai.djl.util.JsonUtils;

import java.io.Serializable;
import java.util.List;

/**
 * A result of all joints found during Human Pose Estimation on a single image.
 *
 * @see Wikipedia
 */
public class Joints implements Serializable {

    private static final long serialVersionUID = 1L;

    @SuppressWarnings("serial")
    private List joints;

    /**
     * Constructs the {@code Joints} with the provided joints.
     *
     * @param joints the joints
     */
    public Joints(List joints) {
        this.joints = joints;
    }

    /**
     * Gets the joints for the image.
     *
     * @return the list of joints
     */
    public List getJoints() {
        return joints;
    }

    /** {@inheritDoc} */
    @Override
    public String toString() {
        return JsonUtils.GSON_PRETTY.toJson(this) + "\n";
    }

    /**
     * A joint that was detected using Human Pose Estimation on an image.
     *
     * @see Joints
     */
    public static class Joint extends Point {

        private static final long serialVersionUID = 1L;

        private double confidence;

        /**
         * Constructs a Joint with given data.
         *
         * @param x the x coordinate of the joint
         * @param y the y coordinate of the joint
         * @param confidence the confidence probability for the joint
         */
        public Joint(double x, double y, double confidence) {
            super(x, y);
            this.confidence = confidence;
        }

        /**
         * Returns the confidence probability for the joint.
         *
         * @return the confidence
         */
        public double getConfidence() {
            return confidence;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy