AI-MXNet-Gluon-ModelZoo

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

);


my %FallbackPrereqs = (
  "AI::MXNet" => "1.31",
  "AI::MXNet::Gluon::Contrib" => "1.3",
  "IO::Uncompress::Unzip" => "0"
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};
  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

WriteMakefile(%WriteMakefileArgs);

examples/image_classification.pl  view on Meta::CPAN

## get a pretrained model (download parameters file if necessary)
my $net = get_model($model, pretrained => 1);

## ImageNet classes
my $fname = download('http://data.mxnet.io/models/imagenet/synset.txt');
my @text_labels = map { chomp; s/^\S+\s+//; $_ } IO::File->new($fname)->getlines;

## get the image from the disk or net
if($image =~ /^https/)
{
    eval { require IO::Socket::SSL; };
    die "Need to have IO::Socket::SSL installed for https images" if $@;
}
$image = $image =~ /^https?/ ? download($image) : $image;

# Following the conventional way of preprocessing ImageNet data:
# Resize the short edge into 256 pixes,
# And then perform a center crop to obtain a 224-by-224 image.
# The following code uses the image processing functions provided 
# in the AI::MXNet::Image module.

lib/AI/MXNet/Gluon/ModelZoo/Vision.pm  view on Meta::CPAN

    if($short_name)
    {
        $short_name =~ s/[^\w:]//g;
        if(length $short_name)
        {
            my $short_name_package =<<"EOP";
            package $short_name;
            \@${short_name}::ISA = ('AI::MXNet::Gluon::ModelZoo::Vision');
            1;
EOP
            eval $short_name_package;
        }
    }
}

1;



( run in 0.621 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )