小编Mon*_*lal的帖子

错误:“PyThreadState”{aka“struct _ts”}没有名为“exc_type”的成员;您的意思是“curexc_type”吗?构建 Cython 扩展时

我在 Python 3.8 中收到以下错误,而在 Python 3.6 中则没有收到该错误。我怎样才能让它与Python 3.8一起工作?为了重现该错误,请按照此处操作: https: //github.com/davidstutz/mesh-fusion/issues/7

\n
[3645:3637 0:2090] 11:04:08 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu\n$ python setup.py build_ext --inplace\nAdded OpenMP\nrunning build_ext\nskipping \'cyfusion.cpp\' Cython extension (up-to-date)\nbuilding \'cyfusion\' extension\nx86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include -I/home/mona/venv/tsdf/include -I/usr/include/python3.8 -c cyfusion.cpp -o build/temp.linux-x86_64-3.8/cyfusion.o -ffast-math -msse -msse2 -msse3 -msse4.2 -fopenmp\nIn file included from /home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822,\n                 from /home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from cyfusion.cpp:531:\n/home/mona/venv/tsdf/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using …
Run Code Online (Sandbox Code Playgroud)

c++ python linux struct cython

8
推荐指数
1
解决办法
8716
查看次数

ruamel_yaml.constructor.ConstructorError:无法确定“<unicode string>”中标签“tag:yaml.org,2002:python/tuple”的构造函数

我正在尝试下载 Kinetics-600 数据集进行活动识别,为此我遵循此存储库中的说明:https://github.com/activitynet/ActivityNet

但是,在这一步conda env create -f environment.yml我收到此错误:

ruamel_yaml.constructor.ConstructorError:无法确定“”第 2 行第 11 列中标签“tag:yaml.org,2002:python/tuple”的构造函数:通道:!!python/tuple

我应该如何修复这个错误?

错误的完整报告是:

(base) /mnt/disks/mona/ActivityNet/Crawler/Kinetics$ conda env create -f environment.yml

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/site-packages/conda/exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "/opt/conda/lib/python3.7/site-packages/conda_env/cli/main.py", line 80, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/opt/conda/lib/python3.7/site-packages/conda_env/cli/main_create.py", line 87, in execute
        spec = specs.detect(name=name, filename=filename, directory=os.getcwd())
      File "/opt/conda/lib/python3.7/site-packages/conda_env/specs/__init__.py", line 43, in detect
        if spec.can_handle():
      File "/opt/conda/lib/python3.7/site-packages/conda_env/specs/yaml_file.py", line 18, in can_handle …
Run Code Online (Sandbox Code Playgroud)

python yaml conda ruamel.yaml

8
推荐指数
1
解决办法
7961
查看次数

查看.npy图像

在处理我为项目下载的一些代码并学习Python时,代码从中提取的一些文件是保存为.npy数据文件的图像.

我相对较新,Python并且numpy在发布之前我浏览过的很多资源都是将数据保存为.npy.有没有办法可以查看使用此扩展程序存储的图像,以及以该格式保存自己的文件?

python arrays numpy image

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

错误:无法卸载“wrapt”。安装tensorflow-gpu时~=1.14

我正在尝试安装以下版本的 TensorFlow-GPU,因为 gitrepo 的作者在这里建议了它。

[jalal@goku examples]$ pip install tensorflow-gpu~=1.14
Collecting tensorflow-gpu~=1.14
  Using cached https://files.pythonhosted.org/packages/a5/ad/933140e74973fb917a194ab814785e7c23680ca5dee6d663a509fe9579b6/tensorflow_gpu-1.15.0-cp36-cp36m-manylinux2010_x86_64.whl
Processing /home/grad3/jalal/.cache/pip/wheels/d7/de/2e/efa132238792efb6459a96e85916ef8597fcb3d2ae51590dfd/wrapt-1.11.2-cp36-cp36m-linux_x86_64.whl
Requirement already satisfied: protobuf>=3.6.1 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (3.11.0)
Requirement already satisfied: tensorflow-estimator==1.15.1 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.15.1)
Requirement already satisfied: six>=1.10.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.13.0)
Requirement already satisfied: wheel>=0.26 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.33.6)
Requirement already satisfied: tensorboard<1.16.0,>=1.15.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.15.0)
Requirement already satisfied: termcolor>=1.1.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.1.0)
Requirement already satisfied: opt-einsum>=2.3.2 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) …
Run Code Online (Sandbox Code Playgroud)

python linux centos pip tensorflow

7
推荐指数
3
解决办法
1万
查看次数

`对比<-`(`*tmp*`,value = contr.funs [1 + isOF [nn]])出错:对比只能应用于2级或更多级别的因子

我有以下代码用于使用optim()来查找beta0和beta1来最小化偏差之和但我收到以下错误我不知道我做错了什么:

sum.abs.dev<-function(beta=c(beta0,beta1),a,b)
{
  total<-0
  n<-length(b)
  for (i in 1:n)
  {
    total <- total + (b[i]-beta[1]-beta[2]*a[i])
  }
  return(total)
}
tlad <- function(y = "farm", x = "land", data="FarmLandArea.csv")
{

  dat <- read.csv(data)

  #fit<-lm(dat$farm~dat$land)
  fit<-lm(y~x,data=dat)
  beta.out=optim(fit$coefficients,sum.abs.dev)

  return(beta.out)
}
Run Code Online (Sandbox Code Playgroud)

这是错误和警告:

Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : 
  contrasts can be applied only to factors with 2 or more levels In addition: Warning message:
In model.response(mf, "numeric") : NAs introduced by coercion
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

csv optimization regression r function

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

块池<registering>的初始化失败(Datanode Uuid未分配)

这个错误的来源是什么?如何修复?

2015-11-29 19:40:04,670 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool <registering> (Datanode Uuid unassigned) service to anmol-vm1-new/10.0.1.190:8020. Exiting.
java.io.IOException: All specified directories are not accessible or do not exist.
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:217)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:254)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:974)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:945)
        at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:278)
        at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:220)
        at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:816)
        at java.lang.Thread.run(Thread.java:745)
2015-11-29 19:40:04,670 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Ending block pool service for: Block pool <registering> (Datanode Uuid unassigned) service to anmol-vm1-new/10.0.1.190:8020
2015-11-29 19:40:04,771 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Removed Block pool <registering> (Datanode Uuid unassigned)
Run Code Online (Sandbox Code Playgroud)

java uuid hadoop disk hdfs

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

numpy TypeError:输入类型和输入不支持 ufunc 'invert'

对于下面的代码:

def makePrediction(mytheta, myx):
    # -----------------------------------------------------------------
    pr = sigmoid(np.dot(myx, mytheta))

    pr[pr < 0.5] =0
    pr[pr >= 0.5] = 1

    return pr

    # -----------------------------------------------------------------

# Compute the percentage of samples I got correct:
pos_correct = float(np.sum(makePrediction(theta,pos)))
neg_correct = float(np.sum(np.invert(makePrediction(theta,neg))))
tot = len(pos)+len(neg)
prcnt_correct = float(pos_correct+neg_correct)/tot
print("Fraction of training samples correctly predicted: %f." % prcnt_correct)
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-33-f0c91286cd02> in <module>()
     13 # Compute the percentage of samples I got correct:
     14 pos_correct = float(np.sum(makePrediction(theta,pos)))
---> 15 …
Run Code Online (Sandbox Code Playgroud)

python numpy machine-learning matrix logistic-regression

6
推荐指数
2
解决办法
4万
查看次数

RuntimeError:只能计算浮点类型的平均值。取而代之的是字节。对于平均值 += images_data.mean(2).sum(0)

我有以下代码:

# Device configuration
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
seed = 42
np.random.seed(seed)
torch.manual_seed(seed)

# split the dataset into validation and test sets
len_valid_set = int(0.1*len(dataset))
len_train_set = len(dataset) - len_valid_set

print("The length of Train set is {}".format(len_train_set))
print("The length of Test set is {}".format(len_valid_set))

train_dataset , valid_dataset,  = torch.utils.data.random_split(dataset , [len_train_set, len_valid_set])

# shuffle and batch the datasets
train_loader = torch.utils.data.DataLoader(train_dataset, batch_size=8, shuffle=True, num_workers=4)
test_loader = torch.utils.data.DataLoader(valid_dataset, batch_size=8, shuffle=True, num_workers=4)

print("LOADERS",
    len(dataloader),
    len(train_loader),
    len(test_loader))
Run Code Online (Sandbox Code Playgroud)

火车组的长度是720

测试集的长度为80

装载机 …

python deep-learning pytorch dataloader

6
推荐指数
1
解决办法
8757
查看次数

冲突的原因是: 用​​户请求的tensorboard==2.1.0 tensorflow 1.15.4依赖于tensorboard&lt;1.16.0 and &gt;=1.15.0

我正在尝试从 git 存储库安装 VIBE 包,并且最初我正在安装它的依赖项。代码位于此处: https: //github.com/mkocabas/VIBE我应该如何解决这个问题?

\n

这是我得到的错误:

\n
(vibe-env) mona@mona:~/research/VIBE$ pip install -r requirements.txt\nRequirement already satisfied: numpy==1.17.5 in /home/mona/anaconda3/envs/vibe-env/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (1.17.5)\nRequirement already satisfied: torchvision==0.5.0 in /home/mona/anaconda3/envs/vibe-env/lib/python3.7/site-packages (from -r requirements.txt (line 19)) (0.5.0)\nCollecting git+https://github.com/mattloper/chumpy.git (from -r requirements.txt (line 24))\n  Cloning https://github.com/mattloper/chumpy.git to /tmp/pip-req-build-vdh2h3jw\nCollecting git+https://github.com/mkocabas/yolov3-pytorch.git (from -r requirements.txt (line 25))\n  Cloning https://github.com/mkocabas/yolov3-pytorch.git to /tmp/pip-req-build-ay_gkil2\nCollecting git+https://github.com/mkocabas/multi-person-tracker.git (from -r requirements.txt (line 26))\n  Cloning https://github.com/mkocabas/multi-person-tracker.git to /tmp/pip-req-build-l9jgk1qb\nRequirement already satisfied: six>=1.11.0 in /home/mona/anaconda3/envs/vibe-env/lib/python3.7/site-packages (from chumpy==0.70->-r requirements.txt (line 24)) (1.15.0)\nCollecting …
Run Code Online (Sandbox Code Playgroud)

python pip tensorflow tensorboard pytorch

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

CMake:不支持的 GNU 版本 - 不支持高于 8 的 gcc 版本

在降级我的 GCC 之前,我想知道是否有一种方法可以确定我的机器中的哪些程序/框架或依赖项将被破坏,以及是否有更好的方法来安装 openpose?(例如更改 CMake 中的某些内容)

有没有办法可以解决这个问题,而无需更改我的系统 GCC 版本并可能破坏其他东西?

[10889:10881 0:2009] 09:21:36 Wed Jan 06 [mona@goku:pts/0 +1] ~/research/code/openpose/build
$ make -j`nproc`
[ 12%] Performing configure step for 'openpose_lib'
CMake Warning (dev) at cmake/Misc.cmake:32 (set):
  implicitly converting 'BOOLEAN' to 'STRING' type.
Call Stack (most recent call first):
  CMakeLists.txt:25 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found gflags  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found glog    (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- Found PROTOBUF Compiler: /usr/local/bin/protoc
-- HDF5: …
Run Code Online (Sandbox Code Playgroud)

c++ linux ubuntu gcc cmake

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