none
Running tutorial script fails

    Question

  • Hi,

    I am trying to run several different U-SQL scripts I find in tutorial sites. I get errors whether running it from the portal or from VS using DL tools. Just to be sure, I am trying to analyze some of the images included in the example data, so I know there should be nothing wrong with the images. I am pretty sure, I am pointing to the right folder, since it complains a different way, if I point to a non-existent folder.

    An example script could be:

    REFERENCE ASSEMBLY ImageCommon;
    REFERENCE ASSEMBLY ImageTagging; 
    
    @images=
             EXTRACT FileName string, ImgData byte[]
    
    		FROM @"/usqlext/samples/cognition/{FileName}.jpg"
             USING new Cognition.Vision.ImageExtractor();
    
    @TaggedObjects=
        PROCESS @images 
        PRODUCE FileName,
                NumObjects int,
                Tags string
        READONLY FileName
        USING new Cognition.Vision.ImageTagger();
    
    
    OUTPUT @TaggedObjects
    TO "/Billeder/ImageTags.tsv"
       USING Outputters.Tsv();

    It complains:

    ****************************************************************

    Vertex failure triggered quick job abort. Vertex failed: SV2_Extract[0] with error: Vertex user code error.

    Vertex SV2_Extract[0].v1 {8F835EE8-B36E-403E-A8E9-00BFF21351E9} failed 

    Error:
    Vertex user code error

    exitcode=CsExitCode_StillActive Errorsnippet=

    Unhandled exception from user code: "Bad type in Set<T> method, column: Tags, index: 2, expected: System.String, actual: Microsoft.Analytics.Types.Sql.SqlMap`2[System.String,System.Nullable`1[System.Single]]"
    The details includes more information including any inner exceptions and the stack trace where the exception was raised.

    ==== Caught exception System.ArgumentException

       at ScopeEngineManaged.SqlIpUpdatableRow.Validate[T](Int32 index, T value)
       at ScopeEngineManaged.SqlIpUpdatableRow.Set[T](Int32 index, T value)
       at Cognition.Vision.ImageTagger.Process(IRow input, IUpdatableRow output)
       at ScopeEngine.SqlIpProcessor<Process_1_Data0,SV1_Extract_out0>.GetNextRow(SqlIpProcessor<Process_1_Data0\,SV1_Extract_out0>* , SV1_Extract_out0* output) in d:\data\ccs\jobs\da2c7814-9338-4a63-8492-d8368674b135_v0\sqlmanaged.h:line 2148
       at std._Func_class<void>.()(_Func_class<void>* )
       at RunAndHandleClrExceptions(function<void __cdecl(void)>* code)

    ****************************************************************

    Thanks in advance for any suggestion or help!

    Monday, October 9, 2017 6:55 PM

Answers

All replies


  • You appear to be following an outdated tutorial as Tags is now a SQL.MAP.  For an updated example of using ImageTagger, see Image Tagging (U-SQL).

    • Edited by CateArcher Monday, October 9, 2017 8:44 PM typo...
    • Marked as answer by Christian Vinter Tuesday, October 10, 2017 7:03 PM
    Monday, October 9, 2017 8:42 PM

  • You appear to be following an outdated tutorial as Tags is now a SQL.MAP.  For an updated example of using ImageTagger, see Image Tagging (U-SQL).

    Thanks very much for your helpful and quick answer! I will try that and mark as answer. Thanks!
    Tuesday, October 10, 2017 5:59 AM
  • For anyone else's info, this is the working code:

    REFERENCE ASSEMBLY ImageCommon;
    REFERENCE ASSEMBLY ImageTagging; 

    @images=
             EXTRACT FileName string, ImgData byte[]

    FROM @"/Billeder/{FileName}.jpg"
             USING new Cognition.Vision.ImageExtractor();

    //@TaggedObjects=
    //    PROCESS @images 
    //    PRODUCE FileName,
    //            NumObjects int,
    //            Tags string
    //    READONLY FileName
    //    USING new Cognition.Vision.ImageTagger();

    @TaggedObjects =
        PROCESS @images 
        PRODUCE FileName,
                NumObjects int,
                Tags SQL.MAP<string, float?>
        READONLY FileName
        USING new Cognition.Vision.ImageTagger();

    @result1A = 
        SELECT  FileName,
                NumObjects,
                T.key AS Content,
                T.value AS Confidence
        FROM    @TaggedObjects
        CROSS APPLY EXPLODE (Tags) AS T(key, value);

    OUTPUT @result1A 
    TO "/Billeder/ImageTags.tsv"
       USING Outputters.Tsv();

    Tuesday, October 10, 2017 7:04 PM