view yolo.xml @ 26:17f0c9ef9da3 draft

Uploaded
author greg
date Thu, 19 Oct 2017 10:35:04 -0400
parents f8b16e55b18c
children b416787d41b0
line wrap: on
line source

<tool id="yolo" name="YOLO" version="1.0">
    <description>real-time object detection</description>
    <requirements>
        <requirement type="package" version="1.0">darknet</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
mkdir input_dir &&
cp -R /home/greg/_conda/envs/__darknet@1.0/bin/* .
#set input = $input_type_cond.input
#if str($input_type_cond.input_type) == 'image':
    #set input_filename = $input.file_name
    #set full_name = $input.name
    && ln -s $input_filename input_dir/$full_name
    #if str($output_shape_confidence_log) == 'yes':
        && darknet detect cfg/yolo.cfg yolo.weights 'input_dir/$full_name' -thresh $thresh 2> $output_shape_confidence
    #else:
        && darknet detect cfg/yolo.cfg yolo.weights 'input_dir/$full_name' -thresh $thresh 2> /dev/null
    && mv ./predictions.png $output_shape
#else:
    && mkdir output_shape_confidence_dir
    && mkdir output_png_dir
    #for $i in $input:
        #set input_filename = $i.file_name
        #set full_name = $i.name
        #set head = $full_name.split('.')[0]
        #set output_filename_png = '%s_predictions.png' % $head
        #set output_filename_shape_confidence = '%s_shape_detection_confidence.txt' % $head
        && ln -s $input_filename input_dir/$full_name
        && darknet detect cfg/yolo.cfg yolo.weights 'input_dir/$full_name' -thresh $thresh 2> output_shape_confidence_dir/$output_filename_shape_confidence
        && mv ./predictions.png output_png_dir/$output_filename_png
    #end for
#end if
    ]]></command>
    <inputs>
        <conditional name="input_type_cond">
            <param name="input_type" type="select" label="Select">
                <option value="image" selected="true">a single image</option>
                <option value="images">a collection of images</option>
            </param>
            <when value="image">
                <param name="input" format="jpg" type="data" label="Image"/>
            </when>
            <when value="images">
                <param name="input" format="jpg" type="data_collection" collection_type="list" label="Collection of image files"/>
            </when>
        </conditional>
        <param name="thresh" type="float" value="0.25" label="Object detection threshold"/>
        <param name="output_shape_confidence_log" type="select" display="radio" label="Output shape detection confidence levels?">
            <option value="yes" selected="true">Yes</option>
            <option value="no">No</option>
        </param>
    </inputs>
    <outputs>
        <data name="output_shape_confidence" format="txt" label="${tool.name} (shape detection confidence) on ${on_string}">
            <filter>input_type_cond['input_type'] == 'image' and output_shape_confidence_log == 'yes'</filter>
        </data>
        <data name="output_shape" format="png" label="${tool.name} (shapes) on ${on_string}">
            <filter>input_type_cond['input_type'] == 'image'</filter>
        </data>
        <collection name="output_shape_confidences" type="list" label="${tool.name} (shape detection confidence) on ${on_string}">
            <discover_datasets pattern="__name__" directory="output_shape_confidence_dir" format="txt"/>
            <filter>input_type_cond['input_type'] == 'images' and output_shape_confidence_log == 'yes'</filter>
        </collection>
        <collection name="output_shapes" type="list" label="${tool.name} (shapes) on ${on_string}">
            <discover_datasets pattern="__name__" directory="output_png_dir" format="png"/>
            <filter>input_type_cond['input_type'] == 'images'</filter>
        </collection>
    </outputs>
    <tests>
        <test>
        <test>
            <param name="input" value="person_small.jpg" ftype="jpg"/>
            <output name="output_shape_confidence" file="output_shape_confidence.txt" ftype="txt" compare="contains"/>
            <output name="output_shape" file="output_shape1.jpg" ftype="jpg"/>
        </test>
        </test>
    </tests>
    <help>
**What it does**

You only look once (YOLO) is a state-of-the-art, real-time object detection system.

-----

**Options**

    </help>
    <citations>
        <citation type="bibtex">
            @misc{darknet13,
            author = {Joseph Redmon},
            title = {Darknet: Open Source Neural Networks in C},
            url = {http://pjreddie.com/darknet/},
            year = {2013--2016}}
        </citation>
        <citation type="bibtex">
            @article{redmon2016yolo9000,
            title={YOLO9000: Better, Faster, Stronger},
            author={Redmon, Joseph and Farhadi, Ali},
            journal={arXiv preprint arXiv:1612.08242},
            year={2016}}
        </citation>
    </citations>
</tool>