小编Ala*_*one的帖子

YOLOV8如何处理不同的图像尺寸

Yolov8 和我怀疑 Yolov5 可以很好地处理非方形图像。我看不到任何裁剪输入图像的证据,即检测似乎到达最长边的边缘。它是否会调整为 640x604 的正方形,从而改变对象的纵横比,使它们更难以检测?

当从预训练模型开始对自定义数据集进行训练时,imgsz(图像大小)参数实际上有什么作用?

python deep-learning conv-neural-network yolo

9
推荐指数
1
解决办法
2万
查看次数

我什么时候可以使用点表示法来访问Python中的字典

我正在“健身房”环境的上下文中修改某人的代码,并发现使用点符号来访问字典。下面的代码片段显示gym中的字典可以使用该表示法,但是当我复制它时它会抛出错误。

import gym
env = gym.Env
env = make('connectx', debug=True)
config = env.configuration
print(config)
print(config.timeout)
dct = {'timeout': 5, 'columns': 7, 'rows': 6, 'inarow': 4, 'steps': 1000}
print(dct.timeout)
Run Code Online (Sandbox Code Playgroud)

这提供了以下输出:

{'timeout': 5, 'columns': 7, 'rows': 6, 'inarow': 4, 'steps': 1000}
5

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
   <ipython-input-45-674d59d34c55> in <module>
      6 print(config.timeout)
      7 dct = {'timeout': 5, 'columns': 7, 'rows': 6, 'inarow': 4, 'steps': 1000}
----> 8 print(dct.timeout)

AttributeError: 'dict' object has no attribute 'timeout'
Run Code Online (Sandbox Code Playgroud)

我正在使用 Python 3。有人可以解释一下吗?谢谢

python dictionary notation

4
推荐指数
1
解决办法
8086
查看次数

numpy fromstring 不推荐使用 frombuffer 代替

在 Python 代码中使用 numpy 1.18.1

` def printBoard(self): current = self.player other = self.player % 2 + 1

    currBin   = '{:049b}'.format(self.current_position)
    currRev = currBin[::-1]

    cArr = (np.fromstring(currRev,'u1') - ord('0'))*current

    other_position = self.current_position^self.mask
    othBin   = '{:049b}'.format(other_position)
    othRev = othBin[::-1]

    oArr = (np.fromstring(othRev,'u1') - ord('0'))*other

    tArr =  oArr+cArr

    brd = np.reshape(tArr,(7,7),order = 'F')
    for y in range(bitBoard.HEIGHT,-1,-1):
        for x in range(bitBoard.WIDTH):
            print(brd[y,x],end = ' ')
        print()
    print()
    `
Run Code Online (Sandbox Code Playgroud)

线:

cArr = (np.fromstring(currRev,'u1') - ord('0'))*current
Run Code Online (Sandbox Code Playgroud)

给出以下警告:

DeprecationWarning: The binary mode of fromstring is …
Run Code Online (Sandbox Code Playgroud)

python string numpy typeerror deprecation-warning

2
推荐指数
1
解决办法
5316
查看次数