libyolo.c:67:11:错误:从类型'network * {aka struct network *}'分配类型'network {aka struct network}'时出现不兼容的类型

时间:2018-02-19 00:52:06

标签: python object-detection darknet

我正在使用YOLO处理对象检测项目。我正在尝试安装" pyyolo"。我试图遵循其official repo中的每一步。但是,当我跑 make(第三步),它给了我这个错误:

gcc  -Wall -Wfatal-errors -Wno-unused-result -fPIC -I./darknet/src -I./darknet/include -Ofast -c libyolo.c -o obj/libyolo.o
libyolo.c: In function ‘yolo_init’:
libyolo.c:67:11: error: incompatible types when assigning to type ‘network {aka struct network}’ from type ‘network * {aka struct network *}’
  obj->net = parse_network_cfg(cfgfile);
       ^
compilation terminated due to -Wfatal-errors.
Makefile:63: recipe for target 'obj/libyolo.o' failed
make: *** [obj/libyolo.o] Error 1

如果有人知道解决方案,或者甚至知道这个错误意味着什么,那么我们将非常感激。

这是 Makefile

文件
GPU=0
CUDNN=0
DEBUG=0
OPENCV=0
ARCH= -gencode arch=compute_20,code=[sm_20,sm_21] \
  -gencode arch=compute_30,code=sm_30 \
  -gencode arch=compute_35,code=sm_35 \
  -gencode arch=compute_50,code=[sm_50,compute_50] \
  -gencode arch=compute_52,code=[sm_52,compute_52]
# This is what I use, uncomment if you know your arch and want to specify
# ARCH= -gencode arch=compute_52,code=compute_52
VPATH=./darknet/src/:./darknet/examples
LIB=libyolo.a
OBJDIR=./obj/
CC=gcc
AR=ar
NVCC=nvcc 
OPTS=-Ofast
COMMON= 
CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -fPIC
CFLAGS+=-I./darknet/src -I./darknet/include
ifeq ($(DEBUG), 1) 
OPTS=-O0 -g
endif

CFLAGS+=$(OPTS)
ifeq ($(OPENCV), 1) 
COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
COMMON+= `pkg-config --cflags opencv` 

endif

ifeq ($(GPU), 1) 
COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU
endif

ifeq ($(CUDNN), 1) 
COMMON+= -DCUDNN 
CFLAGS+= -DCUDNN
endif

OBJ=libyolo.o gemm.o utils.o cuda.o deconvolutional_layer.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o regressor.o classifier.o local_layer.o swag.o shortcut_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o lsd.o super.o voxel.o tree.o lstm_layer.o
ifeq ($(GPU), 1) 
OBJ+=convolutional_kernels.o deconvolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o network_kernels.o avgpool_layer_kernels.o
endif

OBJS = $(addprefix $(OBJDIR), $(OBJ))
DEPS = $(wildcard src/*.h) Makefile

all: obj $(LIB)

$(LIB): $(OBJS)
    $(AR) rcs $@ $^

$(OBJDIR)%.o: %.c $(DEPS)
    $(CC) $(COMMON) $(CFLAGS) -c $< -o $@

$(OBJDIR)%.o: %.cu $(DEPS)
    $(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@

obj:
    mkdir -p obj

.PHONY: clean

clean:
    rm -rf $(OBJS) $(LIB)

1 个答案:

答案 0 :(得分:0)

有类似的错误。只需清理并再次使用'--recursive'标志进行结帐。 注意:不要编译darknet然后编译pyyolo,编译pyyolo本身,如果仅在CPU上使用,请不要忘记在Makefile中禁用GPU,CUDNN标志