mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Initial fork and modified to use cmake
This commit is contained in:
parent
3a2a020c8b
commit
623a707be9
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,6 +16,8 @@ convnet/
|
||||
decaf/
|
||||
submission/
|
||||
cfg/
|
||||
weights/
|
||||
build/
|
||||
darknet
|
||||
.fuse*
|
||||
|
||||
|
29
.idea/codeStyles/Project.xml
Normal file
29
.idea/codeStyles/Project.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
2
.idea/darknet.iml
Normal file
2
.idea/darknet.iml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
7
.idea/misc.xml
Normal file
7
.idea/misc.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/darknet.iml" filepath="$PROJECT_DIR$/.idea/darknet.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
759
.idea/workspace.xml
Normal file
759
.idea/workspace.xml
Normal file
@ -0,0 +1,759 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true" buildAllGenerated="true">
|
||||
<generated>
|
||||
<config projectName="darknet" targetName="DarkNet" />
|
||||
<config projectName="darknet" targetName="darknet" />
|
||||
</generated>
|
||||
</component>
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" GENERATION_DIR="build" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3bfbf356-8fb4-42b7-9cf0-3c2abcc5c096" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/attention.c" beforeDir="false" afterPath="$PROJECT_DIR$/examples/attention.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/dice.c" beforeDir="false" afterPath="$PROJECT_DIR$/examples/dice.c.HIDE" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/swag.c" beforeDir="false" afterPath="$PROJECT_DIR$/examples/swag.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/voxel.c" beforeDir="false" afterPath="$PROJECT_DIR$/examples/voxel.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/examples/writing.c" beforeDir="false" afterPath="$PROJECT_DIR$/examples/writing.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/activation_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/avgpool_layer_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/blas_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/col2im_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/compare.c" beforeDir="false" afterPath="$PROJECT_DIR$/src/compare.c.HIDE" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/convolutional_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/convolutional_layer.c" beforeDir="false" afterPath="$PROJECT_DIR$/src/convolutional_layer.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/crop_layer_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/deconvolutional_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/dropout_layer_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/im2col_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/maxpool_layer_kernels.cu" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/parser.c" beforeDir="false" afterPath="$PROJECT_DIR$/src/parser.c" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
|
||||
<ignored path="$PROJECT_DIR$/build/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="1699346290">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="2" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.open.time.2" value="1" />
|
||||
<entry key="project.open.time.4" value="1" />
|
||||
<entry key="project.open.time.9" value="1" />
|
||||
<entry key="project.opened" value="4" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="Makefile" value="1" />
|
||||
<entry key="c" value="62" />
|
||||
<entry key="cu" value="4" />
|
||||
<entry key="gitignore" value="16" />
|
||||
<entry key="h" value="3" />
|
||||
<entry key="txt" value="902" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="CMakeLists.txt" value="902" />
|
||||
<entry key="ObjectiveC" value="69" />
|
||||
<entry key="PLAIN_TEXT" value="17" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="HIDE" value="1" />
|
||||
<entry key="Makefile" value="8" />
|
||||
<entry key="OLD" value="2" />
|
||||
<entry key="c" value="40" />
|
||||
<entry key="cfg" value="1" />
|
||||
<entry key="cpp" value="1" />
|
||||
<entry key="cu" value="3" />
|
||||
<entry key="gitignore" value="1" />
|
||||
<entry key="h" value="17" />
|
||||
<entry key="mit" value="1" />
|
||||
<entry key="txt" value="11" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="CMakeLists.txt" value="11" />
|
||||
<entry key="ObjectiveC" value="62" />
|
||||
<entry key="PLAIN_TEXT" value="13" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<splitter split-orientation="horizontal" split-proportion="0.5">
|
||||
<split-first>
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="15">
|
||||
<caret line="1" column="17" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="17" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/include/darknet.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="285">
|
||||
<caret line="19" column="13" selection-start-line="19" selection-start-column="13" selection-end-line="19" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/parser.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/convolutional_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" column="12" selection-start-line="6" selection-start-column="12" selection-end-line="6" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret column="12" selection-start-column="12" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/l2norm_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/layer.c">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/option_list.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="51" column="4" selection-start-line="51" selection-start-column="4" selection-end-line="51" selection-end-column="4" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="285">
|
||||
<caret line="19" column="6" selection-start-line="19" selection-start-column="6" selection-end-line="19" selection-end-column="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</split-first>
|
||||
<split-second>
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/yolo.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4440">
|
||||
<caret line="296" column="84" selection-start-line="296" selection-start-column="84" selection-end-line="296" selection-end-column="84" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/darknet.c">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/parser.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="313">
|
||||
<caret line="745" column="13" selection-start-line="745" selection-start-column="13" selection-end-line="745" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/network.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="369">
|
||||
<caret line="54" column="30" selection-start-line="54" selection-start-column="30" selection-end-line="54" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/examples/detector.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="8520">
|
||||
<caret line="568" column="25" selection-start-line="568" selection-start-column="25" selection-end-line="568" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/maxpool_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/utils.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="347">
|
||||
<caret line="252" column="5" selection-start-line="252" selection-start-column="5" selection-end-line="252" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="210">
|
||||
<caret line="14" column="58" selection-start-line="14" selection-start-column="58" selection-end-line="14" selection-end-column="58" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</split-second>
|
||||
</splitter>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="CMakeLists.txt" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>gpu</find>
|
||||
<find>main(</find>
|
||||
<find>&net</find>
|
||||
<find>net.</find>
|
||||
<find>run_yolo</find>
|
||||
<find>%d x %d /</find>
|
||||
<find>conv %5d %2d</find>
|
||||
<find>load</find>
|
||||
<find>net</find>
|
||||
<find>load_</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>net-></replace>
|
||||
<replace>net</replace>
|
||||
</replaceStrings>
|
||||
<dirStrings>
|
||||
<dir>$PROJECT_DIR$/src</dir>
|
||||
<dir>$PROJECT_DIR$</dir>
|
||||
</dirStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/examples/attention.c" />
|
||||
<option value="$PROJECT_DIR$/src/compare.c" />
|
||||
<option value="$PROJECT_DIR$/src/image.c" />
|
||||
<option value="$PROJECT_DIR$/examples/swag.c" />
|
||||
<option value="$PROJECT_DIR$/examples/dice.c" />
|
||||
<option value="$PROJECT_DIR$/examples/writing.c" />
|
||||
<option value="$PROJECT_DIR$/examples/voxel.c" />
|
||||
<option value="$PROJECT_DIR$/src/convolutional_layer.c" />
|
||||
<option value="$PROJECT_DIR$/src/cuda/convolutional_kernels.cu" />
|
||||
<option value="$PROJECT_DIR$/Makefile" />
|
||||
<option value="$PROJECT_DIR$/src/parser.c" />
|
||||
<option value="$PROJECT_DIR$/include/darknet.h" />
|
||||
<option value="$PROJECT_DIR$/examples/art.c" />
|
||||
<option value="$PROJECT_DIR$/examples/darknet.c" />
|
||||
<option value="$PROJECT_DIR$/src/CMakeLists.txt" />
|
||||
<option value="$PROJECT_DIR$/CMakeLists.txt" />
|
||||
<option value="$PROJECT_DIR$/examples/CMakeLists.txt" />
|
||||
<option value="$PROJECT_DIR$/.gitignore" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsGulpfileManager">
|
||||
<detection-done>true</detection-done>
|
||||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="OCFindUsagesOptions" text="true" ivars="false" properties="true" derivedClasses="false" />
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="49" />
|
||||
<option name="y" value="-4" />
|
||||
<option name="width" value="1871" />
|
||||
<option name="height" value="1204" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="darknet" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="darknet" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="darknet" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="darknet" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="include" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../ossimlabs" />
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
<property name="settings.editor.selected.configurable" value="CMakeSettings" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/examples" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.darknet">
|
||||
<configuration name="Build All" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" CONFIG_NAME="Debug" EXPLICIT_BUILD_TARGET_NAME="all">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="DarkNet" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="darknet" TARGET_NAME="DarkNet" CONFIG_NAME="Debug">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="darknet" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="detect cfg/yolov2-tiny.cfg weights/yolov2-tiny-voc.weights data/dog.jpg" WORKING_DIR="file://$PROJECT_DIR$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="darknet" TARGET_NAME="darknet" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="darknet" RUN_TARGET_NAME="darknet">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Application.Build All" />
|
||||
<item itemvalue="Application.darknet" />
|
||||
<item itemvalue="Application.DarkNet" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="3bfbf356-8fb4-42b7-9cf0-3c2abcc5c096" name="Default Changelist" comment="" />
|
||||
<created>1551799986641</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1551799986641</updated>
|
||||
<workItem from="1551799990987" duration="5814000" />
|
||||
<workItem from="1551813347605" duration="22781000" />
|
||||
<workItem from="1552935465896" duration="2499000" />
|
||||
<workItem from="1552959859845" duration="7935000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="39029000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="49" y="-4" width="1871" height="1204" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.18082191" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32960895" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32960895" />
|
||||
<window_info anchor="bottom" id="Cvs" order="3" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="4" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="5" />
|
||||
<window_info anchor="bottom" id="Docker" order="6" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" x="2321" y="211" width="1129" height="523" id="Messages" order="8" type="FLOATING" visible="true" weight="0.2811918" />
|
||||
<window_info anchor="bottom" id="Terminal" order="9" />
|
||||
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Version Control" order="11" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" x="72" y="421" width="1825" height="353" id="CMake" order="12" visible="true" weight="0.32867783" />
|
||||
<window_info anchor="bottom" x="49" y="120" width="1871" height="1025" id="Debug" order="13" type="WINDOWED" weight="0.39851025" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Database" order="3" />
|
||||
</layout>
|
||||
<layout-to-restore>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24759872" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Messages" order="9" weight="0.2811918" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" />
|
||||
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Version Control" order="12" show_stripe_button="false" />
|
||||
<window_info active="true" anchor="bottom" id="CMake" order="13" visible="true" weight="0.32867783" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Database" order="3" />
|
||||
</layout-to-restore>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
<option featureType="com.intellij.fileTypeFactory" implementationName="*.cfg" />
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/src/parser.c</url>
|
||||
<line>1172</line>
|
||||
<option name="timeStamp" value="3" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/src/network.c</url>
|
||||
<line>54</line>
|
||||
<option name="timeStamp" value="4" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/examples/coco.c">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/convolutional_kernels.cu" />
|
||||
<entry file="file://$PROJECT_DIR$/examples/attention.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4500">
|
||||
<caret line="300" column="38" selection-start-line="300" selection-start-column="38" selection-end-line="300" selection-end-column="38" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/compare.c.HIDE">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="915">
|
||||
<caret line="61" column="36" selection-start-line="61" selection-start-column="36" selection-end-line="61" selection-end-column="36" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/swag.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="218">
|
||||
<caret line="17" column="13" selection-start-line="17" selection-start-column="13" selection-end-line="17" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/writing.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="233">
|
||||
<caret line="117" column="32" selection-start-line="117" selection-start-column="32" selection-end-line="117" selection-end-column="32" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/voxel.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="83">
|
||||
<caret line="119" column="42" selection-start-line="119" selection-start-column="42" selection-end-line="119" selection-end-column="42" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/go.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="7005">
|
||||
<caret line="467" selection-start-line="467" selection-end-line="467" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/avgpool_layer_kernels.cu" />
|
||||
<entry file="file://$PROJECT_DIR$/LICENSE.mit">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/dice.c.HIDE">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="218">
|
||||
<caret line="33" selection-start-line="33" selection-end-line="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/image_opencv.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/network.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="270">
|
||||
<caret line="18" column="18" selection-start-line="18" selection-start-column="18" selection-end-line="18" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/Makefile.OLD" />
|
||||
<entry file="file://$PROJECT_DIR$/src/cuda/convolutional_kernels.cu">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="900">
|
||||
<caret line="60" column="30" selection-start-line="60" selection-start-column="30" selection-end-line="60" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/image.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2279">
|
||||
<caret line="536" column="48" selection-start-line="536" selection-start-column="48" selection-end-line="536" selection-end-column="48" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/local_layer.c">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cfg/yolov2-tiny.cfg">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="12" lean-forward="true" selection-start-line="11" selection-start-column="12" selection-end-line="11" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/gemm.h">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/batchnorm_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/batchnorm_layer.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="690">
|
||||
<caret line="46" column="48" selection-start-line="46" selection-start-column="48" selection-end-line="46" selection-end-column="48" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/activations.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="705">
|
||||
<caret line="47" column="43" selection-start-line="47" selection-start-column="43" selection-end-line="47" selection-end-column="43" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/activation_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="7" column="56" selection-start-line="7" selection-start-column="56" selection-end-line="7" selection-end-column="56" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/activation_layer.c">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/blas.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2295">
|
||||
<caret line="153" selection-start-line="153" selection-end-line="153" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/Makefile" />
|
||||
<entry file="file://$PROJECT_DIR$/src/gemm.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="229">
|
||||
<caret line="84" selection-start-line="84" selection-end-line="84" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/convolutional_layer.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="8295">
|
||||
<caret line="553" column="4" selection-start-line="553" selection-start-column="4" selection-end-line="553" selection-end-column="4" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/maxpool_layer.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="570">
|
||||
<caret line="38" column="51" selection-start-line="38" selection-start-column="51" selection-end-line="38" selection-end-column="51" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/parser.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/convolutional_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" column="12" selection-start-line="6" selection-start-column="12" selection-end-line="6" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/l2norm_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/yolo.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="4440">
|
||||
<caret line="296" column="84" selection-start-line="296" selection-start-column="84" selection-end-line="296" selection-end-column="84" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/maxpool_layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/layer.c">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/layer.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret column="12" selection-start-column="12" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/network.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="369">
|
||||
<caret line="54" column="30" selection-start-line="54" selection-start-column="30" selection-end-line="54" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/parser.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="313">
|
||||
<caret line="745" column="13" selection-start-line="745" selection-start-column="13" selection-end-line="745" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/include/darknet.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="285">
|
||||
<caret line="19" column="13" selection-start-line="19" selection-start-column="13" selection-end-line="19" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/option_list.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="51" column="4" selection-start-line="51" selection-start-column="4" selection-end-line="51" selection-end-column="4" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/utils.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="347">
|
||||
<caret line="252" column="5" selection-start-line="252" selection-start-column="5" selection-end-line="252" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/detector.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="8520">
|
||||
<caret line="568" column="25" selection-start-line="568" selection-start-column="25" selection-end-line="568" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/art.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="33" selection-start-line="12" selection-start-column="33" selection-end-line="12" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/darknet.c">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="210">
|
||||
<caret line="14" column="58" selection-start-line="14" selection-start-column="58" selection-end-line="14" selection-end-column="58" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="15">
|
||||
<caret line="1" column="17" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="17" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/examples/CMakeLists.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="285">
|
||||
<caret line="19" column="6" selection-start-line="19" selection-start-column="6" selection-end-line="19" selection-end-column="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
55
CMakeLists.txt
Normal file
55
CMakeLists.txt
Normal file
@ -0,0 +1,55 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(darknet C)
|
||||
|
||||
set(GPU 1)
|
||||
set(CUDNN 0)
|
||||
set(OPENCV 0)
|
||||
set(OPENMP 0)
|
||||
set(DEBUG 1)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(DEBUG 1)
|
||||
|
||||
include_directories(src include)
|
||||
|
||||
set (OPTS -Ofast)
|
||||
|
||||
if ( DEBUG )
|
||||
set(OPTS ${OPTS} -O0 -g )
|
||||
endif()
|
||||
|
||||
set ( NVCC nvcc )
|
||||
set ( AR ar )
|
||||
set ( ARFLAGS rcs )
|
||||
set ( LDFLAGS -lm -pthread )
|
||||
set ( CFLAGS ${OPTS} -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC)
|
||||
|
||||
if ( OPENMP )
|
||||
set(CFLAGS ${CFLAGS} -fopenmp )
|
||||
endif()
|
||||
|
||||
if ( OPENCV )
|
||||
set(COMMON ${COMMON} -DOPENCV )
|
||||
set(CFLAGS ${CFLAGS} -DOPENCV )
|
||||
set(LDFLAGS ${LDFLAGS} -L${env.OPENCV_HOME}/lib -lopencv_core -lstdc++)
|
||||
endif()
|
||||
|
||||
if ( GPU )
|
||||
set(COMMON ${COMMON} -DGPU -I/usr/local/cuda/include/ )
|
||||
set(CFLAGS ${CFLAGS} -DGPU )
|
||||
set(LDFLAGS ${LDFLAGS} -lstdc++ -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand)
|
||||
endif()
|
||||
|
||||
if ( CUDNN )
|
||||
set(COMMON ${COMMON} -DCUDNN )
|
||||
set(CFLAGS ${CFLAGS} -DCUDNN )
|
||||
set(LDFLAGS ${LDFLAGS} -lcudnn)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(examples)
|
||||
|
105
Makefile
105
Makefile
@ -1,105 +0,0 @@
|
||||
GPU=0
|
||||
CUDNN=0
|
||||
OPENCV=0
|
||||
OPENMP=0
|
||||
DEBUG=0
|
||||
|
||||
ARCH= -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]
|
||||
# -gencode arch=compute_20,code=[sm_20,sm_21] \ This one is deprecated?
|
||||
|
||||
# This is what I use, uncomment if you know your arch and want to specify
|
||||
# ARCH= -gencode arch=compute_52,code=compute_52
|
||||
|
||||
VPATH=./src/:./examples
|
||||
SLIB=libdarknet.so
|
||||
ALIB=libdarknet.a
|
||||
EXEC=darknet
|
||||
OBJDIR=./obj/
|
||||
|
||||
CC=gcc
|
||||
CPP=g++
|
||||
NVCC=nvcc
|
||||
AR=ar
|
||||
ARFLAGS=rcs
|
||||
OPTS=-Ofast
|
||||
LDFLAGS= -lm -pthread
|
||||
COMMON= -Iinclude/ -Isrc/
|
||||
CFLAGS=-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC
|
||||
|
||||
ifeq ($(OPENMP), 1)
|
||||
CFLAGS+= -fopenmp
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTS=-O0 -g
|
||||
endif
|
||||
|
||||
CFLAGS+=$(OPTS)
|
||||
|
||||
ifeq ($(OPENCV), 1)
|
||||
COMMON+= -DOPENCV
|
||||
CFLAGS+= -DOPENCV
|
||||
LDFLAGS+= `pkg-config --libs opencv` -lstdc++
|
||||
COMMON+= `pkg-config --cflags opencv`
|
||||
endif
|
||||
|
||||
ifeq ($(GPU), 1)
|
||||
COMMON+= -DGPU -I/usr/local/cuda/include/
|
||||
CFLAGS+= -DGPU
|
||||
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
|
||||
endif
|
||||
|
||||
ifeq ($(CUDNN), 1)
|
||||
COMMON+= -DCUDNN
|
||||
CFLAGS+= -DCUDNN
|
||||
LDFLAGS+= -lcudnn
|
||||
endif
|
||||
|
||||
OBJ=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 detection_layer.o route_layer.o upsample_layer.o box.o normalization_layer.o avgpool_layer.o layer.o local_layer.o shortcut_layer.o logistic_layer.o activation_layer.o rnn_layer.o gru_layer.o crnn_layer.o demo.o batchnorm_layer.o region_layer.o reorg_layer.o tree.o lstm_layer.o l2norm_layer.o yolo_layer.o iseg_layer.o image_opencv.o
|
||||
EXECOBJA=captcha.o lsd.o super.o art.o tag.o cifar.o go.o rnn.o segmenter.o regressor.o classifier.o coco.o yolo.o detector.o nightmare.o instance-segmenter.o darknet.o
|
||||
ifeq ($(GPU), 1)
|
||||
LDFLAGS+= -lstdc++
|
||||
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 avgpool_layer_kernels.o
|
||||
endif
|
||||
|
||||
EXECOBJ = $(addprefix $(OBJDIR), $(EXECOBJA))
|
||||
OBJS = $(addprefix $(OBJDIR), $(OBJ))
|
||||
DEPS = $(wildcard src/*.h) Makefile include/darknet.h
|
||||
|
||||
all: obj backup results $(SLIB) $(ALIB) $(EXEC)
|
||||
#all: obj results $(SLIB) $(ALIB) $(EXEC)
|
||||
|
||||
|
||||
$(EXEC): $(EXECOBJ) $(ALIB)
|
||||
$(CC) $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(ALIB)
|
||||
|
||||
$(ALIB): $(OBJS)
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
$(SLIB): $(OBJS)
|
||||
$(CC) $(CFLAGS) -shared $^ -o $@ $(LDFLAGS)
|
||||
|
||||
$(OBJDIR)%.o: %.cpp $(DEPS)
|
||||
$(CPP) $(COMMON) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(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
|
||||
backup:
|
||||
mkdir -p backup
|
||||
results:
|
||||
mkdir -p results
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS) $(SLIB) $(ALIB) $(EXEC) $(EXECOBJ) $(OBJDIR)/*
|
||||
|
6
examples/CMakeLists.txt
Normal file
6
examples/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
message("In ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
FILE(GLOB EXAMPLE_SOURCES "*.c" PARENT_SCOPE)
|
||||
add_executable(darknet ${EXAMPLE_SOURCES} )
|
||||
SET_TARGET_PROPERTIES(darknet PROPERTIES LINKER_LANGUAGE C)
|
||||
TARGET_LINK_LIBRARIES(darknet DarkNet pthread m)
|
||||
|
@ -287,7 +287,7 @@ void validate_attention_single(char *datacfg, char *filename, char *weightfile)
|
||||
printf("\n");
|
||||
copy_cpu(classes, pred, 1, avgs, 1);
|
||||
top_k(pred + classes, divs*divs, divs*divs, inds);
|
||||
show_image(crop, "crop");
|
||||
show_image(crop, "crop", 0);
|
||||
for(j = 0; j < extra; ++j){
|
||||
int index = inds[j];
|
||||
int row = index / divs;
|
||||
@ -298,7 +298,7 @@ void validate_attention_single(char *datacfg, char *filename, char *weightfile)
|
||||
image tile = crop_image(crop, x, y, net->w, net->h);
|
||||
float *pred = network_predict(net, tile.data);
|
||||
axpy_cpu(classes, 1., pred, 1, avgs, 1);
|
||||
show_image(tile, "tile");
|
||||
show_image(tile, "tile", 0);
|
||||
//cvWaitKey(10);
|
||||
}
|
||||
if(net->hierarchy) hierarchy_predictions(pred, net->outputs, net->hierarchy, 1, 1);
|
||||
|
@ -9,16 +9,16 @@ void train_swag(char *cfgfile, char *weightfile)
|
||||
char *base = basecfg(cfgfile);
|
||||
printf("%s\n", base);
|
||||
float avg_loss = -1;
|
||||
network net = parse_network_cfg(cfgfile);
|
||||
network* net = parse_network_cfg(cfgfile);
|
||||
if(weightfile){
|
||||
load_weights(&net, weightfile);
|
||||
load_weights(net, weightfile);
|
||||
}
|
||||
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
|
||||
int imgs = net.batch*net.subdivisions;
|
||||
int i = *net.seen/imgs;
|
||||
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net->learning_rate, net->momentum, net->decay);
|
||||
int imgs = net->batch*net->subdivisions;
|
||||
int i = *net->seen/imgs;
|
||||
data train, buffer;
|
||||
|
||||
layer l = net.layers[net.n - 1];
|
||||
layer l = net->layers[net->n - 1];
|
||||
|
||||
int side = l.side;
|
||||
int classes = l.classes;
|
||||
@ -29,8 +29,8 @@ void train_swag(char *cfgfile, char *weightfile)
|
||||
char **paths = (char **)list_to_array(plist);
|
||||
|
||||
load_args args = {0};
|
||||
args.w = net.w;
|
||||
args.h = net.h;
|
||||
args.w = net->w;
|
||||
args.h = net->h;
|
||||
args.paths = paths;
|
||||
args.n = imgs;
|
||||
args.m = plist->size;
|
||||
@ -43,7 +43,7 @@ void train_swag(char *cfgfile, char *weightfile)
|
||||
pthread_t load_thread = load_data_in_thread(args);
|
||||
clock_t time;
|
||||
//while(i*imgs < N*120){
|
||||
while(get_current_batch(net) < net.max_batches){
|
||||
while(get_current_batch(net) < net->max_batches){
|
||||
i += 1;
|
||||
time=clock();
|
||||
pthread_join(load_thread, 0);
|
||||
|
@ -44,13 +44,13 @@ void train_voxel(char *cfgfile, char *weightfile)
|
||||
char *base = basecfg(cfgfile);
|
||||
printf("%s\n", base);
|
||||
float avg_loss = -1;
|
||||
network net = parse_network_cfg(cfgfile);
|
||||
network* net = parse_network_cfg(cfgfile);
|
||||
if(weightfile){
|
||||
load_weights(&net, weightfile);
|
||||
load_weights(net, weightfile);
|
||||
}
|
||||
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
|
||||
int imgs = net.batch*net.subdivisions;
|
||||
int i = *net.seen/imgs;
|
||||
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net->learning_rate, net->momentum, net->decay);
|
||||
int imgs = net->batch*net->subdivisions;
|
||||
int i = *(net->seen)/imgs;
|
||||
data train, buffer;
|
||||
|
||||
|
||||
@ -59,8 +59,8 @@ void train_voxel(char *cfgfile, char *weightfile)
|
||||
char **paths = (char **)list_to_array(plist);
|
||||
|
||||
load_args args = {0};
|
||||
args.w = net.w;
|
||||
args.h = net.h;
|
||||
args.w = net->w;
|
||||
args.h = net->h;
|
||||
args.scale = 4;
|
||||
args.paths = paths;
|
||||
args.n = imgs;
|
||||
@ -71,7 +71,7 @@ void train_voxel(char *cfgfile, char *weightfile)
|
||||
pthread_t load_thread = load_data_in_thread(args);
|
||||
clock_t time;
|
||||
//while(i*imgs < N*120){
|
||||
while(get_current_batch(net) < net.max_batches){
|
||||
while(get_current_batch(net) < net->max_batches){
|
||||
i += 1;
|
||||
time=clock();
|
||||
pthread_join(load_thread, 0);
|
||||
@ -105,11 +105,11 @@ void train_voxel(char *cfgfile, char *weightfile)
|
||||
|
||||
void test_voxel(char *cfgfile, char *weightfile, char *filename)
|
||||
{
|
||||
network net = parse_network_cfg(cfgfile);
|
||||
network* net = parse_network_cfg(cfgfile);
|
||||
if(weightfile){
|
||||
load_weights(&net, weightfile);
|
||||
load_weights(net, weightfile);
|
||||
}
|
||||
set_batch_network(&net, 1);
|
||||
set_batch_network(net, 1);
|
||||
srand(2222222);
|
||||
|
||||
clock_t time;
|
||||
@ -126,7 +126,7 @@ void test_voxel(char *cfgfile, char *weightfile, char *filename)
|
||||
strtok(input, "\n");
|
||||
}
|
||||
image im = load_image_color(input, 0, 0);
|
||||
resize_network(&net, im.w, im.h);
|
||||
resize_network(net, im.w, im.h);
|
||||
printf("%d %d\n", im.w, im.h);
|
||||
|
||||
float *X = im.data;
|
||||
|
@ -7,12 +7,12 @@ void train_writing(char *cfgfile, char *weightfile)
|
||||
float avg_loss = -1;
|
||||
char *base = basecfg(cfgfile);
|
||||
printf("%s\n", base);
|
||||
network net = parse_network_cfg(cfgfile);
|
||||
network* net = parse_network_cfg(cfgfile);
|
||||
if(weightfile){
|
||||
load_weights(&net, weightfile);
|
||||
load_weights(net, weightfile);
|
||||
}
|
||||
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
|
||||
int imgs = net.batch*net.subdivisions;
|
||||
printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net->learning_rate, net->momentum, net->decay);
|
||||
int imgs = net->batch*net->subdivisions;
|
||||
list *plist = get_paths("figures.list");
|
||||
char **paths = (char **)list_to_array(plist);
|
||||
clock_t time;
|
||||
@ -23,8 +23,8 @@ void train_writing(char *cfgfile, char *weightfile)
|
||||
data train, buffer;
|
||||
|
||||
load_args args = {0};
|
||||
args.w = net.w;
|
||||
args.h = net.h;
|
||||
args.w = net->w;
|
||||
args.h = net->h;
|
||||
args.out_w = out.w;
|
||||
args.out_h = out.h;
|
||||
args.paths = paths;
|
||||
@ -34,8 +34,8 @@ void train_writing(char *cfgfile, char *weightfile)
|
||||
args.type = WRITING_DATA;
|
||||
|
||||
pthread_t load_thread = load_data_in_thread(args);
|
||||
int epoch = (*net.seen)/N;
|
||||
while(get_current_batch(net) < net.max_batches || net.max_batches == 0){
|
||||
int epoch = *(net->seen)/N;
|
||||
while(get_current_batch(net) < net->max_batches || net->max_batches == 0){
|
||||
time=clock();
|
||||
pthread_join(load_thread, 0);
|
||||
train = buffer;
|
||||
@ -63,15 +63,15 @@ void train_writing(char *cfgfile, char *weightfile)
|
||||
|
||||
if(avg_loss == -1) avg_loss = loss;
|
||||
avg_loss = avg_loss*.9 + loss*.1;
|
||||
printf("%ld, %.3f: %f, %f avg, %f rate, %lf seconds, %ld images\n", get_current_batch(net), (float)(*net.seen)/N, loss, avg_loss, get_current_rate(net), sec(clock()-time), *net.seen);
|
||||
printf("%ld, %.3f: %f, %f avg, %f rate, %lf seconds, %ld images\n", get_current_batch(net), (float)(*(net->seen))/N, loss, avg_loss, get_current_rate(net), sec(clock()-time), *net->seen);
|
||||
free_data(train);
|
||||
if(get_current_batch(net)%100 == 0){
|
||||
char buff[256];
|
||||
sprintf(buff, "%s/%s_batch_%ld.weights", backup_directory, base, get_current_batch(net));
|
||||
save_weights(net, buff);
|
||||
}
|
||||
if(*net.seen/N > epoch){
|
||||
epoch = *net.seen/N;
|
||||
if(*net->seen/N > epoch){
|
||||
epoch = *net->seen/N;
|
||||
char buff[256];
|
||||
sprintf(buff, "%s/%s_%d.weights",backup_directory,base, epoch);
|
||||
save_weights(net, buff);
|
||||
@ -81,11 +81,11 @@ void train_writing(char *cfgfile, char *weightfile)
|
||||
|
||||
void test_writing(char *cfgfile, char *weightfile, char *filename)
|
||||
{
|
||||
network net = parse_network_cfg(cfgfile);
|
||||
network* net = parse_network_cfg(cfgfile);
|
||||
if(weightfile){
|
||||
load_weights(&net, weightfile);
|
||||
load_weights(net, weightfile);
|
||||
}
|
||||
set_batch_network(&net, 1);
|
||||
set_batch_network(net, 1);
|
||||
srand(2222222);
|
||||
clock_t time;
|
||||
char buff[256];
|
||||
@ -102,7 +102,7 @@ void test_writing(char *cfgfile, char *weightfile, char *filename)
|
||||
}
|
||||
|
||||
image im = load_image_color(input, 0, 0);
|
||||
resize_network(&net, im.w, im.h);
|
||||
resize_network(net, im.w, im.h);
|
||||
printf("%d %d %d\n", im.h, im.w, im.c);
|
||||
float *X = im.data;
|
||||
time=clock();
|
||||
@ -114,8 +114,8 @@ void test_writing(char *cfgfile, char *weightfile, char *filename)
|
||||
image thresh = threshold_image(upsampled, .5);
|
||||
pred = thresh;
|
||||
|
||||
show_image(pred, "prediction");
|
||||
show_image(im, "orig");
|
||||
show_image(pred, "prediction", 0);
|
||||
show_image(im, "orig", 0);
|
||||
#ifdef OPENCV
|
||||
cvWaitKey(0);
|
||||
cvDestroyAllWindows();
|
||||
|
15
src/CMakeLists.txt
Normal file
15
src/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
message("In ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
FILE(GLOB_RECURSE HEADER_FILES "*.h" PARENT_SCOPE)
|
||||
FILE(GLOB_RECURSE SOURCE_FILES "*.c" PARENT_SCOPE)
|
||||
|
||||
set(HEADER_FILES ${HEADER_FILES} include/darknet.h PARENT_SCOPE)
|
||||
set(CUDA_FILES)
|
||||
if ( GPU )
|
||||
message("Compiling for GPU...")
|
||||
FILE(GLOB_RECURSE CUDA_FILES "*.cu" PARENT_SCOPE)
|
||||
message("CUDA_FILES = ${CUDA_FILES}")
|
||||
endif()
|
||||
|
||||
message("SOURCE_FILES = ${SOURCE_FILES}")
|
||||
add_library(DarkNet ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_FILES})
|
||||
SET_TARGET_PROPERTIES(DarkNet PROPERTIES LINKER_LANGUAGE C)
|
@ -14,12 +14,12 @@
|
||||
|
||||
void swap_binary(convolutional_layer *l)
|
||||
{
|
||||
float *swap = l->weights;
|
||||
l->weights = l->binary_weights;
|
||||
l->binary_weights = swap;
|
||||
float *swap = l->weights;
|
||||
l->weights = l->binary_weights;
|
||||
l->binary_weights = swap;
|
||||
|
||||
#ifdef GPU
|
||||
swap = l->weights_gpu;
|
||||
swap = l->weights_gpu;
|
||||
l->weights_gpu = l->binary_weights_gpu;
|
||||
l->binary_weights_gpu = swap;
|
||||
#endif
|
||||
@ -27,65 +27,65 @@ void swap_binary(convolutional_layer *l)
|
||||
|
||||
void binarize_weights(float *weights, int n, int size, float *binary)
|
||||
{
|
||||
int i, f;
|
||||
for(f = 0; f < n; ++f){
|
||||
float mean = 0;
|
||||
for(i = 0; i < size; ++i){
|
||||
mean += fabs(weights[f*size + i]);
|
||||
}
|
||||
mean = mean / size;
|
||||
for(i = 0; i < size; ++i){
|
||||
binary[f*size + i] = (weights[f*size + i] > 0) ? mean : -mean;
|
||||
}
|
||||
}
|
||||
int i, f;
|
||||
for(f = 0; f < n; ++f){
|
||||
float mean = 0;
|
||||
for(i = 0; i < size; ++i){
|
||||
mean += fabs(weights[f*size + i]);
|
||||
}
|
||||
mean = mean / size;
|
||||
for(i = 0; i < size; ++i){
|
||||
binary[f*size + i] = (weights[f*size + i] > 0) ? mean : -mean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void binarize_cpu(float *input, int n, float *binary)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < n; ++i){
|
||||
binary[i] = (input[i] > 0) ? 1 : -1;
|
||||
}
|
||||
int i;
|
||||
for(i = 0; i < n; ++i){
|
||||
binary[i] = (input[i] > 0) ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
void binarize_input(float *input, int n, int size, float *binary)
|
||||
{
|
||||
int i, s;
|
||||
for(s = 0; s < size; ++s){
|
||||
float mean = 0;
|
||||
for(i = 0; i < n; ++i){
|
||||
mean += fabs(input[i*size + s]);
|
||||
}
|
||||
mean = mean / n;
|
||||
for(i = 0; i < n; ++i){
|
||||
binary[i*size + s] = (input[i*size + s] > 0) ? mean : -mean;
|
||||
}
|
||||
}
|
||||
int i, s;
|
||||
for(s = 0; s < size; ++s){
|
||||
float mean = 0;
|
||||
for(i = 0; i < n; ++i){
|
||||
mean += fabs(input[i*size + s]);
|
||||
}
|
||||
mean = mean / n;
|
||||
for(i = 0; i < n; ++i){
|
||||
binary[i*size + s] = (input[i*size + s] > 0) ? mean : -mean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int convolutional_out_height(convolutional_layer l)
|
||||
{
|
||||
return (l.h + 2*l.pad - l.size) / l.stride + 1;
|
||||
return (l.h + 2*l.pad - l.size) / l.stride + 1;
|
||||
}
|
||||
|
||||
int convolutional_out_width(convolutional_layer l)
|
||||
{
|
||||
return (l.w + 2*l.pad - l.size) / l.stride + 1;
|
||||
return (l.w + 2*l.pad - l.size) / l.stride + 1;
|
||||
}
|
||||
|
||||
image get_convolutional_image(convolutional_layer l)
|
||||
{
|
||||
return float_to_image(l.out_w,l.out_h,l.out_c,l.output);
|
||||
return float_to_image(l.out_w,l.out_h,l.out_c,l.output);
|
||||
}
|
||||
|
||||
image get_convolutional_delta(convolutional_layer l)
|
||||
{
|
||||
return float_to_image(l.out_w,l.out_h,l.out_c,l.delta);
|
||||
return float_to_image(l.out_w,l.out_h,l.out_c,l.delta);
|
||||
}
|
||||
|
||||
static size_t get_workspace_size(layer l){
|
||||
#ifdef CUDNN
|
||||
if(gpu_index >= 0){
|
||||
if(gpu_index >= 0){
|
||||
size_t most = 0;
|
||||
size_t s = 0;
|
||||
cudnnGetConvolutionForwardWorkspaceSize(cudnn_handle(),
|
||||
@ -115,7 +115,7 @@ static size_t get_workspace_size(layer l){
|
||||
return most;
|
||||
}
|
||||
#endif
|
||||
return (size_t)l.out_h*l.out_w*l.size*l.size*l.c/l.groups*sizeof(float);
|
||||
return (size_t)l.out_h*l.out_w*l.size*l.size*l.c/l.groups*sizeof(float);
|
||||
}
|
||||
|
||||
#ifdef GPU
|
||||
@ -173,93 +173,96 @@ void cudnn_convolutional_setup(layer *l)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
convolutional_layer make_convolutional_layer(int batch, int h, int w, int c, int n, int groups, int size, int stride, int padding, ACTIVATION activation, int batch_normalize, int binary, int xnor, int adam)
|
||||
convolutional_layer
|
||||
make_convolutional_layer(int batch, int h, int w, int c, int n, int groups,
|
||||
int size, int stride, int padding, ACTIVATION activation,
|
||||
int batch_normalize, int binary, int xnor, int adam)
|
||||
{
|
||||
int i;
|
||||
convolutional_layer l = {0};
|
||||
l.type = CONVOLUTIONAL;
|
||||
int i;
|
||||
convolutional_layer l = {0};
|
||||
l.type = CONVOLUTIONAL;
|
||||
|
||||
l.groups = groups;
|
||||
l.h = h;
|
||||
l.w = w;
|
||||
l.c = c;
|
||||
l.n = n;
|
||||
l.binary = binary;
|
||||
l.xnor = xnor;
|
||||
l.batch = batch;
|
||||
l.stride = stride;
|
||||
l.size = size;
|
||||
l.pad = padding;
|
||||
l.batch_normalize = batch_normalize;
|
||||
l.groups = groups;
|
||||
l.h = h;
|
||||
l.w = w;
|
||||
l.c = c;
|
||||
l.n = n;
|
||||
l.binary = binary;
|
||||
l.xnor = xnor;
|
||||
l.batch = batch;
|
||||
l.stride = stride;
|
||||
l.size = size;
|
||||
l.pad = padding;
|
||||
l.batch_normalize = batch_normalize;
|
||||
|
||||
l.weights = calloc(c/groups*n*size*size, sizeof(float));
|
||||
l.weight_updates = calloc(c/groups*n*size*size, sizeof(float));
|
||||
l.weights = calloc(c/groups*n*size*size, sizeof(float));
|
||||
l.weight_updates = calloc(c/groups*n*size*size, sizeof(float));
|
||||
|
||||
l.biases = calloc(n, sizeof(float));
|
||||
l.bias_updates = calloc(n, sizeof(float));
|
||||
l.biases = calloc(n, sizeof(float));
|
||||
l.bias_updates = calloc(n, sizeof(float));
|
||||
|
||||
l.nweights = c/groups*n*size*size;
|
||||
l.nbiases = n;
|
||||
l.nweights = c/groups*n*size*size;
|
||||
l.nbiases = n;
|
||||
|
||||
// float scale = 1./sqrt(size*size*c);
|
||||
float scale = sqrt(2./(size*size*c/l.groups));
|
||||
//printf("convscale %f\n", scale);
|
||||
//scale = .02;
|
||||
//for(i = 0; i < c*n*size*size; ++i) l.weights[i] = scale*rand_uniform(-1, 1);
|
||||
for(i = 0; i < l.nweights; ++i) l.weights[i] = scale*rand_normal();
|
||||
int out_w = convolutional_out_width(l);
|
||||
int out_h = convolutional_out_height(l);
|
||||
l.out_h = out_h;
|
||||
l.out_w = out_w;
|
||||
l.out_c = n;
|
||||
l.outputs = l.out_h * l.out_w * l.out_c;
|
||||
l.inputs = l.w * l.h * l.c;
|
||||
// float scale = 1./sqrt(size*size*c);
|
||||
float scale = sqrt(2./(size*size*c/l.groups));
|
||||
//printf("convscale %f\n", scale);
|
||||
//scale = .02;
|
||||
//for(i = 0; i < c*n*size*size; ++i) l.weights[i] = scale*rand_uniform(-1, 1);
|
||||
for(i = 0; i < l.nweights; ++i) l.weights[i] = scale*rand_normal();
|
||||
int out_w = convolutional_out_width(l);
|
||||
int out_h = convolutional_out_height(l);
|
||||
l.out_h = out_h;
|
||||
l.out_w = out_w;
|
||||
l.out_c = n;
|
||||
l.outputs = l.out_h * l.out_w * l.out_c;
|
||||
l.inputs = l.w * l.h * l.c;
|
||||
|
||||
l.output = calloc(l.batch*l.outputs, sizeof(float));
|
||||
l.delta = calloc(l.batch*l.outputs, sizeof(float));
|
||||
l.output = calloc(l.batch*l.outputs, sizeof(float));
|
||||
l.delta = calloc(l.batch*l.outputs, sizeof(float));
|
||||
|
||||
l.forward = forward_convolutional_layer;
|
||||
l.backward = backward_convolutional_layer;
|
||||
l.update = update_convolutional_layer;
|
||||
if(binary){
|
||||
l.binary_weights = calloc(l.nweights, sizeof(float));
|
||||
l.cweights = calloc(l.nweights, sizeof(char));
|
||||
l.scales = calloc(n, sizeof(float));
|
||||
}
|
||||
if(xnor){
|
||||
l.binary_weights = calloc(l.nweights, sizeof(float));
|
||||
l.binary_input = calloc(l.inputs*l.batch, sizeof(float));
|
||||
}
|
||||
l.forward = forward_convolutional_layer;
|
||||
l.backward = backward_convolutional_layer;
|
||||
l.update = update_convolutional_layer;
|
||||
if(binary){
|
||||
l.binary_weights = calloc(l.nweights, sizeof(float));
|
||||
l.cweights = calloc(l.nweights, sizeof(char));
|
||||
l.scales = calloc(n, sizeof(float));
|
||||
}
|
||||
if(xnor){
|
||||
l.binary_weights = calloc(l.nweights, sizeof(float));
|
||||
l.binary_input = calloc(l.inputs*l.batch, sizeof(float));
|
||||
}
|
||||
|
||||
if(batch_normalize){
|
||||
l.scales = calloc(n, sizeof(float));
|
||||
l.scale_updates = calloc(n, sizeof(float));
|
||||
for(i = 0; i < n; ++i){
|
||||
l.scales[i] = 1;
|
||||
}
|
||||
if(batch_normalize){
|
||||
l.scales = calloc(n, sizeof(float));
|
||||
l.scale_updates = calloc(n, sizeof(float));
|
||||
for(i = 0; i < n; ++i){
|
||||
l.scales[i] = 1;
|
||||
}
|
||||
|
||||
l.mean = calloc(n, sizeof(float));
|
||||
l.variance = calloc(n, sizeof(float));
|
||||
l.mean = calloc(n, sizeof(float));
|
||||
l.variance = calloc(n, sizeof(float));
|
||||
|
||||
l.mean_delta = calloc(n, sizeof(float));
|
||||
l.variance_delta = calloc(n, sizeof(float));
|
||||
l.mean_delta = calloc(n, sizeof(float));
|
||||
l.variance_delta = calloc(n, sizeof(float));
|
||||
|
||||
l.rolling_mean = calloc(n, sizeof(float));
|
||||
l.rolling_variance = calloc(n, sizeof(float));
|
||||
l.x = calloc(l.batch*l.outputs, sizeof(float));
|
||||
l.x_norm = calloc(l.batch*l.outputs, sizeof(float));
|
||||
}
|
||||
if(adam){
|
||||
l.m = calloc(l.nweights, sizeof(float));
|
||||
l.v = calloc(l.nweights, sizeof(float));
|
||||
l.bias_m = calloc(n, sizeof(float));
|
||||
l.scale_m = calloc(n, sizeof(float));
|
||||
l.bias_v = calloc(n, sizeof(float));
|
||||
l.scale_v = calloc(n, sizeof(float));
|
||||
}
|
||||
l.rolling_mean = calloc(n, sizeof(float));
|
||||
l.rolling_variance = calloc(n, sizeof(float));
|
||||
l.x = calloc(l.batch*l.outputs, sizeof(float));
|
||||
l.x_norm = calloc(l.batch*l.outputs, sizeof(float));
|
||||
}
|
||||
if(adam){
|
||||
l.m = calloc(l.nweights, sizeof(float));
|
||||
l.v = calloc(l.nweights, sizeof(float));
|
||||
l.bias_m = calloc(n, sizeof(float));
|
||||
l.scale_m = calloc(n, sizeof(float));
|
||||
l.bias_v = calloc(n, sizeof(float));
|
||||
l.scale_v = calloc(n, sizeof(float));
|
||||
}
|
||||
|
||||
#ifdef GPU
|
||||
l.forward_gpu = forward_convolutional_layer_gpu;
|
||||
l.forward_gpu = forward_convolutional_layer_gpu;
|
||||
l.backward_gpu = backward_convolutional_layer_gpu;
|
||||
l.update_gpu = update_convolutional_layer_gpu;
|
||||
|
||||
@ -319,27 +322,27 @@ convolutional_layer make_convolutional_layer(int batch, int h, int w, int c, int
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
l.workspace_size = get_workspace_size(l);
|
||||
l.activation = activation;
|
||||
l.workspace_size = get_workspace_size(l);
|
||||
l.activation = activation;
|
||||
|
||||
fprintf(stderr, "conv %5d %2d x%2d /%2d %4d x%4d x%4d -> %4d x%4d x%4d %5.3f BFLOPs\n", n, size, size, stride, w, h, c, l.out_w, l.out_h, l.out_c, (2.0 * l.n * l.size*l.size*l.c/l.groups * l.out_h*l.out_w)/1000000000.);
|
||||
fprintf(stderr, "conv %5d %2d x%2d /%2d %4d x%4d x%4d -> %4d x%4d x%4d %5.3f BFLOPs\n", n, size, size, stride, w, h, c, l.out_w, l.out_h, l.out_c, (2.0 * l.n * l.size*l.size*l.c/l.groups * l.out_h*l.out_w)/1000000000.);
|
||||
|
||||
return l;
|
||||
return l;
|
||||
}
|
||||
|
||||
void denormalize_convolutional_layer(convolutional_layer l)
|
||||
{
|
||||
int i, j;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
float scale = l.scales[i]/sqrt(l.rolling_variance[i] + .00001);
|
||||
for(j = 0; j < l.c/l.groups*l.size*l.size; ++j){
|
||||
l.weights[i*l.c/l.groups*l.size*l.size + j] *= scale;
|
||||
}
|
||||
l.biases[i] -= l.rolling_mean[i] * scale;
|
||||
l.scales[i] = 1;
|
||||
l.rolling_mean[i] = 0;
|
||||
l.rolling_variance[i] = 1;
|
||||
}
|
||||
int i, j;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
float scale = l.scales[i]/sqrt(l.rolling_variance[i] + .00001);
|
||||
for(j = 0; j < l.c/l.groups*l.size*l.size; ++j){
|
||||
l.weights[i*l.c/l.groups*l.size*l.size + j] *= scale;
|
||||
}
|
||||
l.biases[i] -= l.rolling_mean[i] * scale;
|
||||
l.scales[i] = 1;
|
||||
l.rolling_mean[i] = 0;
|
||||
l.rolling_variance[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -369,26 +372,26 @@ void test_convolutional_layer()
|
||||
|
||||
void resize_convolutional_layer(convolutional_layer *l, int w, int h)
|
||||
{
|
||||
l->w = w;
|
||||
l->h = h;
|
||||
int out_w = convolutional_out_width(*l);
|
||||
int out_h = convolutional_out_height(*l);
|
||||
l->w = w;
|
||||
l->h = h;
|
||||
int out_w = convolutional_out_width(*l);
|
||||
int out_h = convolutional_out_height(*l);
|
||||
|
||||
l->out_w = out_w;
|
||||
l->out_h = out_h;
|
||||
l->out_w = out_w;
|
||||
l->out_h = out_h;
|
||||
|
||||
l->outputs = l->out_h * l->out_w * l->out_c;
|
||||
l->inputs = l->w * l->h * l->c;
|
||||
l->outputs = l->out_h * l->out_w * l->out_c;
|
||||
l->inputs = l->w * l->h * l->c;
|
||||
|
||||
l->output = realloc(l->output, l->batch*l->outputs*sizeof(float));
|
||||
l->delta = realloc(l->delta, l->batch*l->outputs*sizeof(float));
|
||||
if(l->batch_normalize){
|
||||
l->x = realloc(l->x, l->batch*l->outputs*sizeof(float));
|
||||
l->x_norm = realloc(l->x_norm, l->batch*l->outputs*sizeof(float));
|
||||
}
|
||||
l->output = realloc(l->output, l->batch*l->outputs*sizeof(float));
|
||||
l->delta = realloc(l->delta, l->batch*l->outputs*sizeof(float));
|
||||
if(l->batch_normalize){
|
||||
l->x = realloc(l->x, l->batch*l->outputs*sizeof(float));
|
||||
l->x_norm = realloc(l->x_norm, l->batch*l->outputs*sizeof(float));
|
||||
}
|
||||
|
||||
#ifdef GPU
|
||||
cuda_free(l->delta_gpu);
|
||||
cuda_free(l->delta_gpu);
|
||||
cuda_free(l->output_gpu);
|
||||
|
||||
l->delta_gpu = cuda_make_array(l->delta, l->batch*l->outputs);
|
||||
@ -405,218 +408,218 @@ void resize_convolutional_layer(convolutional_layer *l, int w, int h)
|
||||
cudnn_convolutional_setup(l);
|
||||
#endif
|
||||
#endif
|
||||
l->workspace_size = get_workspace_size(*l);
|
||||
l->workspace_size = get_workspace_size(*l);
|
||||
}
|
||||
|
||||
void add_bias(float *output, float *biases, int batch, int n, int size)
|
||||
{
|
||||
int i,j,b;
|
||||
for(b = 0; b < batch; ++b){
|
||||
for(i = 0; i < n; ++i){
|
||||
for(j = 0; j < size; ++j){
|
||||
output[(b*n + i)*size + j] += biases[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
int i,j,b;
|
||||
for(b = 0; b < batch; ++b){
|
||||
for(i = 0; i < n; ++i){
|
||||
for(j = 0; j < size; ++j){
|
||||
output[(b*n + i)*size + j] += biases[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void scale_bias(float *output, float *scales, int batch, int n, int size)
|
||||
{
|
||||
int i,j,b;
|
||||
for(b = 0; b < batch; ++b){
|
||||
for(i = 0; i < n; ++i){
|
||||
for(j = 0; j < size; ++j){
|
||||
output[(b*n + i)*size + j] *= scales[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
int i,j,b;
|
||||
for(b = 0; b < batch; ++b){
|
||||
for(i = 0; i < n; ++i){
|
||||
for(j = 0; j < size; ++j){
|
||||
output[(b*n + i)*size + j] *= scales[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void backward_bias(float *bias_updates, float *delta, int batch, int n, int size)
|
||||
{
|
||||
int i,b;
|
||||
for(b = 0; b < batch; ++b){
|
||||
for(i = 0; i < n; ++i){
|
||||
bias_updates[i] += sum_array(delta+size*(i+b*n), size);
|
||||
}
|
||||
}
|
||||
int i,b;
|
||||
for(b = 0; b < batch; ++b){
|
||||
for(i = 0; i < n; ++i){
|
||||
bias_updates[i] += sum_array(delta+size*(i+b*n), size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void forward_convolutional_layer(convolutional_layer l, network net)
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
fill_cpu(l.outputs*l.batch, 0, l.output, 1);
|
||||
fill_cpu(l.outputs*l.batch, 0, l.output, 1);
|
||||
|
||||
if(l.xnor){
|
||||
binarize_weights(l.weights, l.n, l.c/l.groups*l.size*l.size, l.binary_weights);
|
||||
swap_binary(&l);
|
||||
binarize_cpu(net.input, l.c*l.h*l.w*l.batch, l.binary_input);
|
||||
net.input = l.binary_input;
|
||||
}
|
||||
if(l.xnor){
|
||||
binarize_weights(l.weights, l.n, l.c/l.groups*l.size*l.size, l.binary_weights);
|
||||
swap_binary(&l);
|
||||
binarize_cpu(net.input, l.c*l.h*l.w*l.batch, l.binary_input);
|
||||
net.input = l.binary_input;
|
||||
}
|
||||
|
||||
int m = l.n/l.groups;
|
||||
int k = l.size*l.size*l.c/l.groups;
|
||||
int n = l.out_w*l.out_h;
|
||||
for(i = 0; i < l.batch; ++i){
|
||||
for(j = 0; j < l.groups; ++j){
|
||||
float *a = l.weights + j*l.nweights/l.groups;
|
||||
float *b = net.workspace;
|
||||
float *c = l.output + (i*l.groups + j)*n*m;
|
||||
float *im = net.input + (i*l.groups + j)*l.c/l.groups*l.h*l.w;
|
||||
int m = l.n/l.groups;
|
||||
int k = l.size*l.size*l.c/l.groups;
|
||||
int n = l.out_w*l.out_h;
|
||||
for(i = 0; i < l.batch; ++i){
|
||||
for(j = 0; j < l.groups; ++j){
|
||||
float *a = l.weights + j*l.nweights/l.groups;
|
||||
float *b = net.workspace;
|
||||
float *c = l.output + (i*l.groups + j)*n*m;
|
||||
float *im = net.input + (i*l.groups + j)*l.c/l.groups*l.h*l.w;
|
||||
|
||||
if (l.size == 1) {
|
||||
b = im;
|
||||
} else {
|
||||
im2col_cpu(im, l.c/l.groups, l.h, l.w, l.size, l.stride, l.pad, b);
|
||||
}
|
||||
gemm(0,0,m,n,k,1,a,k,b,n,1,c,n);
|
||||
}
|
||||
}
|
||||
if (l.size == 1) {
|
||||
b = im;
|
||||
} else {
|
||||
im2col_cpu(im, l.c/l.groups, l.h, l.w, l.size, l.stride, l.pad, b);
|
||||
}
|
||||
gemm(0,0,m,n,k,1,a,k,b,n,1,c,n);
|
||||
}
|
||||
}
|
||||
|
||||
if(l.batch_normalize){
|
||||
forward_batchnorm_layer(l, net);
|
||||
} else {
|
||||
add_bias(l.output, l.biases, l.batch, l.n, l.out_h*l.out_w);
|
||||
}
|
||||
if(l.batch_normalize){
|
||||
forward_batchnorm_layer(l, net);
|
||||
} else {
|
||||
add_bias(l.output, l.biases, l.batch, l.n, l.out_h*l.out_w);
|
||||
}
|
||||
|
||||
activate_array(l.output, l.outputs*l.batch, l.activation);
|
||||
if(l.binary || l.xnor) swap_binary(&l);
|
||||
activate_array(l.output, l.outputs*l.batch, l.activation);
|
||||
if(l.binary || l.xnor) swap_binary(&l);
|
||||
}
|
||||
|
||||
void backward_convolutional_layer(convolutional_layer l, network net)
|
||||
{
|
||||
int i, j;
|
||||
int m = l.n/l.groups;
|
||||
int n = l.size*l.size*l.c/l.groups;
|
||||
int k = l.out_w*l.out_h;
|
||||
int i, j;
|
||||
int m = l.n/l.groups;
|
||||
int n = l.size*l.size*l.c/l.groups;
|
||||
int k = l.out_w*l.out_h;
|
||||
|
||||
gradient_array(l.output, l.outputs*l.batch, l.activation, l.delta);
|
||||
gradient_array(l.output, l.outputs*l.batch, l.activation, l.delta);
|
||||
|
||||
if(l.batch_normalize){
|
||||
backward_batchnorm_layer(l, net);
|
||||
} else {
|
||||
backward_bias(l.bias_updates, l.delta, l.batch, l.n, k);
|
||||
}
|
||||
if(l.batch_normalize){
|
||||
backward_batchnorm_layer(l, net);
|
||||
} else {
|
||||
backward_bias(l.bias_updates, l.delta, l.batch, l.n, k);
|
||||
}
|
||||
|
||||
for(i = 0; i < l.batch; ++i){
|
||||
for(j = 0; j < l.groups; ++j){
|
||||
float *a = l.delta + (i*l.groups + j)*m*k;
|
||||
float *b = net.workspace;
|
||||
float *c = l.weight_updates + j*l.nweights/l.groups;
|
||||
for(i = 0; i < l.batch; ++i){
|
||||
for(j = 0; j < l.groups; ++j){
|
||||
float *a = l.delta + (i*l.groups + j)*m*k;
|
||||
float *b = net.workspace;
|
||||
float *c = l.weight_updates + j*l.nweights/l.groups;
|
||||
|
||||
float *im = net.input + (i*l.groups + j)*l.c/l.groups*l.h*l.w;
|
||||
float *imd = net.delta + (i*l.groups + j)*l.c/l.groups*l.h*l.w;
|
||||
float *im = net.input + (i*l.groups + j)*l.c/l.groups*l.h*l.w;
|
||||
float *imd = net.delta + (i*l.groups + j)*l.c/l.groups*l.h*l.w;
|
||||
|
||||
if(l.size == 1){
|
||||
b = im;
|
||||
} else {
|
||||
im2col_cpu(im, l.c/l.groups, l.h, l.w,
|
||||
l.size, l.stride, l.pad, b);
|
||||
if(l.size == 1){
|
||||
b = im;
|
||||
} else {
|
||||
im2col_cpu(im, l.c/l.groups, l.h, l.w,
|
||||
l.size, l.stride, l.pad, b);
|
||||
}
|
||||
|
||||
gemm(0,1,m,n,k,1,a,k,b,k,1,c,n);
|
||||
|
||||
if (net.delta) {
|
||||
a = l.weights + j*l.nweights/l.groups;
|
||||
b = l.delta + (i*l.groups + j)*m*k;
|
||||
c = net.workspace;
|
||||
if (l.size == 1) {
|
||||
c = imd;
|
||||
}
|
||||
|
||||
gemm(0,1,m,n,k,1,a,k,b,k,1,c,n);
|
||||
gemm(1,0,n,k,m,1,a,n,b,k,0,c,k);
|
||||
|
||||
if (net.delta) {
|
||||
a = l.weights + j*l.nweights/l.groups;
|
||||
b = l.delta + (i*l.groups + j)*m*k;
|
||||
c = net.workspace;
|
||||
if (l.size == 1) {
|
||||
c = imd;
|
||||
}
|
||||
|
||||
gemm(1,0,n,k,m,1,a,n,b,k,0,c,k);
|
||||
|
||||
if (l.size != 1) {
|
||||
col2im_cpu(net.workspace, l.c/l.groups, l.h, l.w, l.size, l.stride, l.pad, imd);
|
||||
}
|
||||
if (l.size != 1) {
|
||||
col2im_cpu(net.workspace, l.c/l.groups, l.h, l.w, l.size, l.stride, l.pad, imd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void update_convolutional_layer(convolutional_layer l, update_args a)
|
||||
{
|
||||
float learning_rate = a.learning_rate*l.learning_rate_scale;
|
||||
float momentum = a.momentum;
|
||||
float decay = a.decay;
|
||||
int batch = a.batch;
|
||||
float learning_rate = a.learning_rate*l.learning_rate_scale;
|
||||
float momentum = a.momentum;
|
||||
float decay = a.decay;
|
||||
int batch = a.batch;
|
||||
|
||||
axpy_cpu(l.n, learning_rate/batch, l.bias_updates, 1, l.biases, 1);
|
||||
scal_cpu(l.n, momentum, l.bias_updates, 1);
|
||||
axpy_cpu(l.n, learning_rate/batch, l.bias_updates, 1, l.biases, 1);
|
||||
scal_cpu(l.n, momentum, l.bias_updates, 1);
|
||||
|
||||
if(l.scales){
|
||||
axpy_cpu(l.n, learning_rate/batch, l.scale_updates, 1, l.scales, 1);
|
||||
scal_cpu(l.n, momentum, l.scale_updates, 1);
|
||||
}
|
||||
if(l.scales){
|
||||
axpy_cpu(l.n, learning_rate/batch, l.scale_updates, 1, l.scales, 1);
|
||||
scal_cpu(l.n, momentum, l.scale_updates, 1);
|
||||
}
|
||||
|
||||
axpy_cpu(l.nweights, -decay*batch, l.weights, 1, l.weight_updates, 1);
|
||||
axpy_cpu(l.nweights, learning_rate/batch, l.weight_updates, 1, l.weights, 1);
|
||||
scal_cpu(l.nweights, momentum, l.weight_updates, 1);
|
||||
axpy_cpu(l.nweights, -decay*batch, l.weights, 1, l.weight_updates, 1);
|
||||
axpy_cpu(l.nweights, learning_rate/batch, l.weight_updates, 1, l.weights, 1);
|
||||
scal_cpu(l.nweights, momentum, l.weight_updates, 1);
|
||||
}
|
||||
|
||||
|
||||
image get_convolutional_weight(convolutional_layer l, int i)
|
||||
{
|
||||
int h = l.size;
|
||||
int w = l.size;
|
||||
int c = l.c/l.groups;
|
||||
return float_to_image(w,h,c,l.weights+i*h*w*c);
|
||||
int h = l.size;
|
||||
int w = l.size;
|
||||
int c = l.c/l.groups;
|
||||
return float_to_image(w,h,c,l.weights+i*h*w*c);
|
||||
}
|
||||
|
||||
void rgbgr_weights(convolutional_layer l)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
image im = get_convolutional_weight(l, i);
|
||||
if (im.c == 3) {
|
||||
rgbgr_image(im);
|
||||
}
|
||||
}
|
||||
int i;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
image im = get_convolutional_weight(l, i);
|
||||
if (im.c == 3) {
|
||||
rgbgr_image(im);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rescale_weights(convolutional_layer l, float scale, float trans)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
image im = get_convolutional_weight(l, i);
|
||||
if (im.c == 3) {
|
||||
scale_image(im, scale);
|
||||
float sum = sum_array(im.data, im.w*im.h*im.c);
|
||||
l.biases[i] += sum*trans;
|
||||
}
|
||||
}
|
||||
int i;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
image im = get_convolutional_weight(l, i);
|
||||
if (im.c == 3) {
|
||||
scale_image(im, scale);
|
||||
float sum = sum_array(im.data, im.w*im.h*im.c);
|
||||
l.biases[i] += sum*trans;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image *get_weights(convolutional_layer l)
|
||||
{
|
||||
image *weights = calloc(l.n, sizeof(image));
|
||||
int i;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
weights[i] = copy_image(get_convolutional_weight(l, i));
|
||||
normalize_image(weights[i]);
|
||||
/*
|
||||
char buff[256];
|
||||
sprintf(buff, "filter%d", i);
|
||||
save_image(weights[i], buff);
|
||||
*/
|
||||
}
|
||||
//error("hey");
|
||||
return weights;
|
||||
image *weights = calloc(l.n, sizeof(image));
|
||||
int i;
|
||||
for(i = 0; i < l.n; ++i){
|
||||
weights[i] = copy_image(get_convolutional_weight(l, i));
|
||||
normalize_image(weights[i]);
|
||||
/*
|
||||
char buff[256];
|
||||
sprintf(buff, "filter%d", i);
|
||||
save_image(weights[i], buff);
|
||||
*/
|
||||
}
|
||||
//error("hey");
|
||||
return weights;
|
||||
}
|
||||
|
||||
image *visualize_convolutional_layer(convolutional_layer l, char *window, image *prev_weights)
|
||||
{
|
||||
image *single_weights = get_weights(l);
|
||||
show_images(single_weights, l.n, window);
|
||||
image *single_weights = get_weights(l);
|
||||
show_images(single_weights, l.n, window);
|
||||
|
||||
image delta = get_convolutional_image(l);
|
||||
image dc = collapse_image_layers(delta, 1);
|
||||
char buff[256];
|
||||
sprintf(buff, "%s: Output", window);
|
||||
//show_image(dc, buff);
|
||||
//save_image(dc, buff);
|
||||
free_image(dc);
|
||||
return single_weights;
|
||||
image delta = get_convolutional_image(l);
|
||||
image dc = collapse_image_layers(delta, 1);
|
||||
char buff[256];
|
||||
sprintf(buff, "%s: Output", window);
|
||||
//show_image(dc, buff);
|
||||
//save_image(dc, buff);
|
||||
free_image(dc);
|
||||
return single_weights;
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,7 @@ int is_network(section *s)
|
||||
|| strcmp(s->type, "[network]")==0);
|
||||
}
|
||||
|
||||
network *parse_network_cfg(char *filename)
|
||||
network* parse_network_cfg(char *filename)
|
||||
{
|
||||
list *sections = read_cfg(filename);
|
||||
node *n = sections->front;
|
||||
|
Loading…
Reference in New Issue
Block a user