小编ppp*_*ery的帖子

Tensorflow:名为 lvis 的 google colab-no 模块上的对象检测 api 错误

我正在尝试'model_main_tf2.py'在 google colab 上运行Tensorflow 对象检测。路径已经定义

os.environ['PYTHONPATH']+=":/content/gdrive/My Drive/TensorFlow_2/models"
os.environ['PYTHONPATH']+=":/content/gdrive/My Drive/TensorFlow_2/models/research"
os.environ['PYTHONPATH']+=":/content/gdrive/My Drive/TensorFlow_2/models/research/slim"
Run Code Online (Sandbox Code Playgroud)

但我有一个错误

 File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/metrics/lvis_evaluation.py", line 23, in <module>
    from lvis import results as lvis_results
ModuleNotFoundError: No module named 'lvis'
Run Code Online (Sandbox Code Playgroud)

python tensorflow google-colaboratory

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

试图不流泪地复制贝叶斯统计数据:采样-重采样的视角,但失败了

我试图不流泪地复制贝叶斯统计论文中的三个数字:采样重采样视角,可以在这里找到:http ://hedibert.org/wp-content/uploads/2013/12/1992SmithGelfand.pdf 我的目标是复制第 5 节的结果。这是我的代码:

theta1<-runif(1000,0,1)
theta2<-runif(1000,0,1)
theta<-cbind(theta1,theta2)
theta<-as.data.frame(theta)

plot(theta1,theta2)

n1<-c(5,6,4)
n2<-c(5,4,6)
y<-c(7,5,6)

l<-rep(NA,nrow(theta))

for (i in 1:nrow(theta)){
  
  llh.1.store<-rep(NA,4)
  for (j in 2:5){
    llh.1.store[j-1]<-(factorial(n1[1])/(factorial(j)*factorial(n1[1]-j)))*(factorial(n2[1])/(factorial(y[1]-j)*factorial(n2[1]-y[1]+j)))*(theta[i,1]^j)*((1-theta[i,1])^(n1[1]-j))*(theta[i,2]^(y[1]-j))*((1-theta[i,2])^(n2[1]-y[1]+j))
  }
  llh1<-sum(llh.1.store)
  
  llh.2.store<-rep(NA,5)
  for (x in 1:5){
    llh.2.store[x]<-(factorial(n1[2])/(factorial(x)*factorial(n1[2]-x)))*(factorial(n2[2])/(factorial(y[2]-x)*factorial(n2[2]-y[2]+x)))*(theta[i,1]^x)*((1-theta[i,1])^(n1[2]-x))*(theta[i,2]^(y[2]-x))*((1-theta[i,2])^(n2[2]-y[2]+x))
  }
  llh2<-sum(llh.2.store)
  
  llh.3.store<-rep(NA,5)
  for (t in 0:4){
    llh.3.store[t+1]<-(factorial(n1[3])/(factorial(t)*factorial(n1[3]-t)))*(factorial(n2[3])/(factorial(y[3]-t)*factorial(n2[3]-y[3]+t)))*(theta[i,1]^t)*((1-theta[i,1])^(n1[3]-t))*(theta[i,2]^(y[3]-t))*((1-theta[i,2])^(n2[3]-y[3]+t))
  }
  llh3<-sum(llh.3.store)
  
  l[i]<-prod(llh1,llh2,llh3)
}

q<-l/sum(l)
post.theta<-sample_n(theta,1000,replace=TRUE,weight=q)

ggplot(post.theta) +
  aes(x = theta1, y = theta2) +
  geom_point(
    shape = "circle",
    size = 1.85,
    colour = "#440154"
  ) +
  labs(title = "Sample from Posterior") +
  ggthemes::theme_few()
Run Code Online (Sandbox Code Playgroud)

但它不会生成与图 2 相同的图。任何人都可以告诉我我做错了什么吗?

statistics r bayesian

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

如何在没有 cypress.json 的情况下配置 cypress-sql-server?

我正在尝试设置 cypress-sql-server,但我使用的是 10.8.0 版本,它不使用 cypress.json 来配置环境。我发现的所有设置说明都涉及使用 cypress.json 来配置插件。我遇到了一个错误:

tasksqlServer:execute, SELECT 'Bob'
CypressError
cy.task('sqlServer:execute') failed with the following error:

The 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task()

Fix this in your setupNodeEvents method here:
D:\git\mcare.automation\client\cypress\cypress.config.jsLearn more
node_modules/cypress-sql-server/src/commands/db.js:7:1
   5 |     }
   6 | 
>  7 |     cy.task('sqlServer:execute', query).then(response => {
     | ^
   8 |       let result = [];
   9 | 
Run Code Online (Sandbox Code Playgroud)

赛普拉斯.config.js

const { defineConfig } = require("cypress");
const sqlServer = require("cypress-sql-server");

module.exports …
Run Code Online (Sandbox Code Playgroud)

automated-tests cypress

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

使用 JavaScript 检查 JavaScript 语法?

像我这样的突击队员如何使用一些 JavaScript 内置方法(如果有!)或任何其他可能的方式检查输入的代码是否是有效的 JavaScript 源?(类似于 NetBeans、Eclipse 等各种 IDE 中的预解析器)?

我必须检查代码是否正常,然后 window.eval()-it 到当前文档实例。

javascript eval syntax-checking

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

Lua意外的符号在'<'附近

我正在尝试在Lua中编写一些东西,你必须在12岁之前将它打印出来"Welcome!".但是,每当我运行此代码时,我都会收到一条错误消息

'<'附近的意外符号.

错误消息表明这是第3行.如果可能,是否有人还可以指出此代码中的其他潜在错误?我的代码如下:

io.write ("Enter your age:")
    age = io.read()
if age == <12 then
    print ("O noes, you are too young!")
elseif age == >12 then
    print ("O noes, you are too old!")
else 
    print ("Welcome, son!")
end
Run Code Online (Sandbox Code Playgroud)

lua garrys-mod

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

带标题和数据的请求

我正在尝试将以下cURL命令转换为Python中的Request.

curl -H 'customheader: value' -H 'customheader2: value' --data "Username=user&UserPassword=pass" https://thisismyurl
Run Code Online (Sandbox Code Playgroud)

据我所知,可以获取头文件和POST数据.那么我怎么做这两个像cURL?

这就是我正在尝试的:

url = 'myurl'
headers = {'customheader': 'value', 'customheader2': 'value'}
data = 'Username=user&UserPassword=pass'

requests.get(url, headers=headers, data=data)
Run Code Online (Sandbox Code Playgroud)

哪个回报: HTTPError: HTTP 405: Method Not Allowed

如果我使用帖子: MissingArgumentError: HTTP 400: Bad Request

python curl python-requests

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

如何检查鼠标是否在某个区域被点击(pygame)

我正在尝试在 pygame 中编写一个程序,如果在某个区域按下鼠标,它将打印一些内容。我尝试过使用 mouse.get_pos 和 mouse.get_pressed 但我不确定我是否正确使用它们。这是我的代码

while True:
    DISPLAYSURF.fill(BLACK)
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            mpos = pygame.mouse.get_pos()
            mpress = pygame.mouse.get_pressed()
            if mpos[0] >= 400 and mpos[1] <= 600 and mpress == True:
                print "Switching Tab"
Run Code Online (Sandbox Code Playgroud)

python pygame

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

如何使用 scikit 图像在 python 中的图像上裁剪一个圆的扇区

我正在为 python 3.5 使用 scikit 图像。我想裁剪一个圆的一个扇区并将其另存为不同的图像。

我所拥有的只是圆的中心(cx,cy),半径 r,圆的周长上的 2 个坐标(x1,y1),(x2,y2),以及一个扇区的 2 条线的方程。

如果它是整个圆,我可以使用圆方程并使图像的其余部分变黑,但由于它是一个扇区,我面临一个问题。

python-3.x scikit-image

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

PyQt5中打开窗口和关闭窗口

我正在尝试从欢迎屏幕加载带有 UI 窗口的新类,同时关闭欢迎屏幕。当我单击按钮打开新窗口时,它可以正常打开,但我只想关闭操作事件的第一个窗口。

我已经尝试过.hide(),,,.terminate().destroy()窗口仍然存在。

这是相关代码:

class MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()                
        #self.email_blast_widget = EmailBlast()
        #self.setCentralWidget(self.email_blast_widget)
        self.welcome = OpeningWindow()
        self.setCentralWidget(self.welcome)        
        bar = self.menuBar()
        file_file = bar.addMenu('File')         
        file_edit = bar.addMenu('Edit')

    def load_email(self):
        self.mail = EmailBlast()        
        self.mail.show()
        self.welcome = OpeningWindow()
        self.destroy()

class OpeningWindow(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()
        self.welcome = QtWidgets.QLabel("Welcome To Zach's \nEmail Blast Widget")
        self.email_button = QtWidgets.QPushButton("Email")
        self.csv_button = QtWidgets.QPushButton("CSVs")
        self.exit_button = QtWidgets.QPushButton("Exit")

        self.init_ui()

 def init_ui(self):
    # set layout to place widgets
    self.email_button.clicked.connect(self.load_email)
    self.csv_button.clicked.connect(self.load_csv)
    #self.exit_button.clicked.connect(self.exit)
    self.exit_button.clicked.connect(QtWidgets.qApp.quit)


class EmailBlast(QtWidgets.QWidget): …
Run Code Online (Sandbox Code Playgroud)

python user-interface pyqt5

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

PHP 注意:使用未定义的常量 php - 假定为 'php'

只是在编辑一个我正在处理的网站,将订阅表格包含在主页中,footer.php而不仅仅是主页。我在本地服务器上进行了更改,然后将其移动到我的实时环境(dev 子文件夹)。我在本地主机上没有看到任何错误,但在开发站点上却显示以下错误:

PHP 注意:使用未定义的常量 php - 在第 1 行的 /home/website-name/public_html/uk-en/dev/wp-content/themes/theme-name/footer.php 中假定为 'php'

第 1 行唯一的内容是打开的 php 标签,请参阅footer.php文件中的以下代码

<?php?>
</div><!-- #main -->
<footer id="colophon" class="site-footer" role="contentinfo">
    <div class="subscribe-form">
        ?<p>SIGN UP TO OUR EMAIL NEWSLETTER FOR NEWS, OFFERS & EXCITING COMPETITIONS.<p>
    <div class="contact-7-subscribe">           <?php echo do_shortcode( '[contact-form-7 id="4563" title="Newsletter"]' ); ?>      </div>
    </div>
    <div class="site-info">
    
        <div class="socialmedia">
            <a href="https://www.facebook.com/pg/page-name/" target="_blank" class="facebook"></a>
            <a href="https://twitter.com/page-name?lang=en" target="_blank" class="twitter"></a>
            <a href="https://www.instagram.com/page-name/" target="_blank" class="youtube"></a>
        </div>
        <div class="payment_cards">
            <img src="<?=site_url();?>/wp-content/uploads/2017/05/payment_cards.png" alt="payments cards"/>
        </div>
        <?php …
Run Code Online (Sandbox Code Playgroud)

php wordpress

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