Deutsch   English   Français   Italiano  
<mailman.50.1722376937.2981.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: Thomas Passin <list1@tompassin.net>
Newsgroups: comp.lang.python
Subject: Re: Predicting an object over an pretrained model is not working
Date: Tue, 30 Jul 2024 17:45:20 -0400
Lines: 278
Message-ID: <mailman.50.1722376937.2981.python-list@python.org>
References: <CAGJtH9Qjv2fQm=_HKwhoGS11uh+u4YoTVzYGHF=2jZC9HpdV9A@mail.gmail.com>
 <263356ef-7ad8-4abc-9940-bd8536ee13eb@tompassin.net>
 <CAGJtH9TnoFa_JJNi=E0oDouKZjq_sfGYmr0WOFOfZtaGcQTyXA@mail.gmail.com>
 <e55832f1-552f-43b8-849f-2a79e77ecbcc@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de n9jeFKzZwx0NFiICIgQpugG5NYQXwH/bLq5Pqj2CnfAA==
Cancel-Lock: sha1:M94y3DkL4R+kdPT8c/uTd0cMD0k= sha256:5qCs96a2vMKE4dAPPu4q6nBmFkmotPe/LM6vfcCbLJs=
Return-Path: <list1@tompassin.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=tompassin.net header.i=@tompassin.net header.b=uPOoSnlk;
 dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'knows': 0.04;
 'image.': 0.07; '"""': 0.09; 'anyway,': 0.09; 'cell.': 0.09;
 'code?': 0.09; 'compute': 0.09; 'coordinate': 0.09; 'ok,': 0.09;
 'output:': 0.09; 'skip:x 10': 0.09; 'subject:not': 0.09;
 'tensorflow': 0.09; 'threshold': 0.09; 'url:mailman': 0.15; '(1,':
 0.16; '2024': 0.16; '=\xc2\xa0': 0.16; 'annotated': 0.16; 'args:':
 0.16; 'box.': 0.16; 'dict': 0.16; 'input.': 0.16; 'possible?':
 0.16; 'predicts': 0.16; 'received:10.0.0': 0.16; 'received:64.90':
 0.16; 'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
 'received:dreamhost.com': 0.16; 'skip:5 20': 0.16;
 'subject:model': 0.16; 'subject:working': 0.16; 'value?': 0.16;
 'wrote:': 0.16; 'problem': 0.16; 'code.': 0.17; "can't": 0.17;
 'calls': 0.19; 'figure': 0.19; 'implement': 0.19; 'pm,': 0.19;
 'to:addr:python-list': 0.20; 'all,': 0.20; 'input': 0.21; 'skip:_
 10': 0.22; "what's": 0.22; 'code': 0.23; 'skip:p 30': 0.23; 'url-
 ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
 'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'classes': 0.26;
 'object': 0.26; 'else': 0.27; 'function': 0.27; 'expect': 0.28;
 'output': 0.28; 'header:User-Agent:1': 0.30; 'code,': 0.31; 'url-
 ip:188/8': 0.31; 'objects': 0.32; 'python-list': 0.32;
 'received:10.0': 0.32; 'received:mailchannels.net': 0.32;
 'received:relay.mailchannels.net': 0.32; "wouldn't": 0.32; 'skip:2
 10': 0.32; 'but': 0.32; 'able': 0.34; 'skip:" 20': 0.34; 'header
 :In-Reply-To:1': 0.34; 'trying': 0.35; 'one.': 0.35; 'skip:2 20':
 0.35; 'following': 0.35; 'fix': 0.36; 'target': 0.36; 'source':
 0.36; 'those': 0.36; "skip:' 10": 0.37; 'really': 0.37; 'using':
 0.37; "it's": 0.37; 'class': 0.37; 'two': 0.39; 'added': 0.39;
 'single': 0.39; 'otherwise': 0.39; '(with': 0.39; 'processed':
 0.40; 'skip:( 30': 0.40; 'want': 0.40; 'skip:0 20': 0.61; 'skip:o
 10': 0.61; 'skip:\xc2 10': 0.62; 'subject': 0.63; 'skip:m 20':
 0.63; 'skip:b 10': 0.63; 'skip:k 10': 0.64; 'key': 0.64; 'skip:r
 20': 0.64; 'probability': 0.64; 'your': 0.64; 'box': 0.65; 'skip:t
 20': 0.66; 'skip:1 20': 0.67; 'areas': 0.67; 'maximum': 0.67;
 'header:Received:6': 0.67; 'received:64': 0.67; 'know.': 0.68;
 'order': 0.69; 'model.': 0.69; 'prediction': 0.69; 'skip:y 30':
 0.69; 'strong': 0.69; 'skip:4 10': 0.75; 'skip:y 10': 0.76;
 'detection': 0.76; 'documented': 0.76; 'database': 0.80;
 'position': 0.81; 'represented': 0.84; 'subject:over': 0.84;
 '\xc3\xa9crit\xc2\xa0:': 0.84; 'greater': 0.91
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1722375921; a=rsa-sha256;
 cv=none;
 b=R7/ta1CKJY6ahTs23f8tUoEuysbccwouYR4A+B62Qa7ary92czGfDOJMHEKdYT/oROk0zP
 2p0wsROmWIV9M9xrytiAg9JGimKL+bVpjBLgbOs2aeMCEzkbNckY/oj7OVUfkWIixQRISq
 Pl9isvZaSZGq/ZZ7r3HnZMU0vCiepF9UXvqSNXNrAB7i/7G7+C0s1yMfGmqzmvxpLJE6Gg
 5YdDoPmI8a7WwidoX5HbAAnc4oo6B9Lk/DxbAeUWuSFECzfazeL1kE8FydE1L/zR9EKQuJ
 lG9qhumapFQq1hMPN/ddqULqYUlm6V4sui55twVla4P9ifqIPrz7ZF2+sB19pg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=mailchannels.net; s=arc-2022; t=1722375921;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references:dkim-signature;
 bh=jHVbcIEKrxNFwWCQZQEFIgxdhD2GcLcqqwmMRpgnBQM=;
 b=bSc67WhFzdlf6a5q4u4Lvk5BRKNhhxgna2+8lOPATyLZNsmdl5CuoOX4A1j9ll/TjceHIc
 wPPakTWChoe1SoZTgK+eLYrFKNBwI+kbkxYG4qALps4E4nTyESa1Yn2XtipvzPeTpy7769
 lZdYUhQPubiQeJG3MrHdKyk00nw1TvyO0+iJY9JB+qMuF8nnOif5fQO8QgKHElZsvFeYbl
 kFZFPdepPLwGMpFUiZcAL7/2eVI6Z8Zw7jM4m71JU8Bv77fqJeHSrZNTsMYKhIvKUcyT+d
 rWKUVD6QwJsUNYRKWmwdIZ7mIFCIRjazy1BSOQGu9/CMobHmvq2TBQFIiemHfg==
ARC-Authentication-Results: i=1; rspamd-5c76f4b4d4-gbwng;
 auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Left-Chief: 49b2ce7972010046_1722375921648_4002512632
X-MC-Loop-Signature: 1722375921648:2361207143
X-MC-Ingress-Time: 1722375921648
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
 s=dreamhost; t=1722375921;
 bh=jHVbcIEKrxNFwWCQZQEFIgxdhD2GcLcqqwmMRpgnBQM=;
 h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
 b=uPOoSnlkb5BrItgRRao6YwUOeGNCSUBYfgXXXUEL+dzJKzNT7XdLdk5YbStWct3yE
 VvpJbS5ug3OghsNXMef3W8ThvmNhoB2XmrNBeMQhfOXzWKQHzNPOMwKNXttRpf0adk
 POYlKXkOtxhUAuO5gNwA01735Sa8Sv8QwdJVhSX4uU/Bcj8+qtIewbxaObPg8mzEq0
 hwA9NeLfkElH7imE0HaIIjZNOfsCxRzDdYuLSbIMWC2NPWGJteqMlrtQCC0Mj3qodx
 7WA4jDg2FiNMsKjrxTJo+Zt18KQgApROUO6N6Ixp6ZbKwBFdgcFW2b0kP/ikliL9Ji
 4wpr5GSxkt3yA==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <CAGJtH9TnoFa_JJNi=E0oDouKZjq_sfGYmr0WOFOfZtaGcQTyXA@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <e55832f1-552f-43b8-849f-2a79e77ecbcc@tompassin.net>
X-Mailman-Original-References: <CAGJtH9Qjv2fQm=_HKwhoGS11uh+u4YoTVzYGHF=2jZC9HpdV9A@mail.gmail.com>
 <263356ef-7ad8-4abc-9940-bd8536ee13eb@tompassin.net>
 <CAGJtH9TnoFa_JJNi=E0oDouKZjq_sfGYmr0WOFOfZtaGcQTyXA@mail.gmail.com>
Bytes: 20897

On 7/30/2024 4:49 PM, marc nicole wrote:
> OK, but how's the probability of small_ball greater than others? I can't 
> find it anyway, what's its value?

It's your code. I wouldn't know. I suppose it's represented somewhere in 
all those parameters. You need to understand what those function calls 
are returning.  It's documented somewhere, right?

And you really do need to know the probabilities of the competing images 
because otherwise you won't know how confident you can be that the 
identification is a strong one.

> Le mar. 30 juil. 2024 à 21:37, Thomas Passin via Python-list 
> <python-list@python.org <mailto:python-list@python.org>> a écrit :
> 
>     On 7/30/2024 2:18 PM, marc nicole via Python-list wrote:
>      > Hello all,
>      >
>      > I want to predict an object by given as input an image and want
>     to have my
>      > model be able to predict the label. I have trained a model using
>     tensorflow
>      > based on annotated database where the target object to predict
>     was added to
>      > the pretrained model. the code I am using is the following where
>     I set the
>      > target object image as input and want to have the prediction output:
>      >
>      >
>      >
>      >
>      >
>      >
>      >
>      >
>      > class MultiObjectDetection():
>      >
>      >      def __init__(self, classes_name):
>      >
>      >          self._classes_name = classes_name
>      >          self._num_classes = len(classes_name)
>      >
>      >          self._common_params = {'image_size': 448, 'num_classes':
>      > self._num_classes,
>      >                  'batch_size':1}
>      >          self._net_params = {'cell_size': 7, 'boxes_per_cell':2,
>      > 'weight_decay': 0.0005}
>      >          self._net = YoloTinyNet(self._common_params,
>     self._net_params,
>      > test=True)
>      >
>      >      def predict_object(self, image):
>      >          predicts = self._net.inference(image)
>      >          return predicts
>      >
>      >      def process_predicts(self, resized_img, predicts, thresh=0.2):
>      >          """
>      >          process the predicts of object detection with one image
>     input.
>      >
>      >          Args:
>      >              resized_img: resized source image.
>      >              predicts: output of the model.
>      >              thresh: thresh of bounding box confidence.
>      >          Return:
>      >              predicts_dict: {"stick": [[x1, y1, x2, y2, scores1],
>     [...]]}.
>      >          """
>      >          cls_num = self._num_classes
>      >          bbx_per_cell = self._net_params["boxes_per_cell"]
>      >          cell_size = self._net_params["cell_size"]
>      >          img_size = self._common_params["image_size"]
>      >          p_classes = predicts[0, :, :, 0:cls_num]
>      >          C = predicts[0, :, :, cls_num:cls_num+bbx_per_cell] # two
>      > bounding boxes in one cell.
>      >          coordinate = predicts[0, :, :, cls_num+bbx_per_cell:] # all
>      > bounding boxes position.
========== REMAINDER OF ARTICLE TRUNCATED ==========